Solved

accessing excel check box from c#

Posted on 2011-03-10
4
2,010 Views
Last Modified: 2012-08-13
Hi,

I would like to access the value of a check box in excel sheet named CheckBox1 using c#.
I tried using
Microsoft.Office.Interop.Excel.Worksheet ws = (Microsoft.Office.Interop.Excel.Worksheet) wb.Sheets.get_Item("Sheet1");
Microsoft.Office.Interop.Excel.CheckBox cb =
(Microsoft.Office.Interop.Excel.CheckBox)ws.Shapes.Item("CheckBox1").OLEFormat.Object;


But, i am getting an exception
"The item with the specified name wasn't found."

Please help me
0
Comment
Question by:sam000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 8

Expert Comment

by:Anurag Agarwal
ID: 35106514
0
 

Author Comment

by:sam000
ID: 35107070
I have checked that. It gives VBA example but not C#
0
 
LVL 7

Accepted Solution

by:
Gene_Cyp earned 500 total points
ID: 35107292
A small tip: at the start of your class add the line:

using Excel = Microsoft.Office.Interop.Excel; // so you don't need to keep typing the whole line


To get your checkbox have a look at these two links:


http://support.microsoft.com/kb/302084

http://stackoverflow.com/questions/4131040/how-to-get-the-value-in-an-excel-dropdown-using-c



0
 

Author Closing Comment

by:sam000
ID: 35273767
It helped
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question