Not able to read Excel values

Add-in Express™ Support Service
That's what is more important than anything else

Not able to read Excel values
Cannot read Excel cell values 
Philip Hua

Posts: 1
Joined: 2006-09-11
public object myFunc(Excel.Range aRange)
for(int i = 1; i <= aRange.Rows.Count; i++){
for (int j = 1; j <= aRange.Columns.Count; j++){
string aValue = aRange.Cells.get_Item(i,j).ToString();

I only get System.___ComObject for aValue. Any idea?
Posted 11 Sep, 2006 12:52:13 Top
Sergey Grischenko

Add-in Express team

Posts: 7235
Joined: 2004-07-05
Hi Philip.

In Excel Object Model the get_Item method returns the Range interface.
You need to cast the value to the Range type using the 'as' operator.
Posted 12 Sep, 2006 05:41:03 Top