“object does not contain a definition for get_Range” in Excel C#


Error:
‘object’ does not contain a definition for ‘get_Range’

Line of Code:
Excel.Range header = wks.get_Range(wks.Cells[1, 1], wks.Cells[1, 10]);
Solution:
Cast the cells as "object" in get_Range()

Excel.Range header = wks.get_Range((object)wks.Cells[1, 1],(object) wks.Cells[1, 10]);

Thanks!

4 thoughts on ““object does not contain a definition for get_Range” in Excel C#”

Leave a Comment