Solved

accessing excel check box from c#

Posted on 2011-03-10
4
1,877 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
  • 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
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 Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
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…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now