Monday, June 4, 2012

Object does not contain a definition for get_Range (MS Excel)

Here's the original snippet that shows the error:
Code:
chartRange = sheet.get_Range(sheet.Cells[row_indicator, column_indicator],  
sheet.Cells[row_indicator, column_indicator + 11]);
Modified snippet:
Code:
 chartRange = sheet.get_Range((object)sheet.Cells[row_indicator, column_indicator],  
 (object)sheet.Cells[row_indicator, column_indicator + 11]); 
Just cast the cells with object.

Cheers!

7 comments: