Solved

accessing excel check box from c#

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa‚Ķ

626 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