Why does it work:
((Excel.Worksheet)Application.ActiveSheet).get_Range("A1", "A1").Value2 = text;
But this is not so:
Excel.Worksheet activeSheet = ((Excel.Worksheet)Application.ActiveSheet);
activeSheet.Cells[0, 0] = text;
I need to do this in a second way, as I need to loop with rowIndex and colIndex. How can i do this?
I get an error message:
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll. More information: Exception from HRESULT: 0x800A03EC
Bob
source
share