I\'m using C# to manipulate an Excel worksheet. The following two pieces of code should work the same, but one works and the other throws an exception. I wonder why.
I had upgraded my VS C# project from .Net Framework 3.5 to 4.5. Once I had upgraded successfully, I got this "object" does not contain a definition for 'get_Range' exception when trying to generate an excel report.
What I did is instead of using below code
range = xlSheet.get_Range(Cells[xlRow, xlCol], Cells[xlRow, xlCol]);
I rewrote to
range = xlSheet.Range[Cells[xlRow, xlCol], xlSheet.Cells[xlRow, xlCol]];
And it worked.