Solved

accessing excel check box from c#

Posted on 2011-03-10
4
2,055 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

Industry Leaders: 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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

710 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