Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

accessing excel check box from c#

Posted on 2011-03-10
4
Medium Priority
?
2,199 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
 

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 1500 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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 …
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

721 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