为什么这个有效:
((Excel.Worksheet)Application.ActiveSheet).get_Range("A1", "A1").Value2 = text;
但是这个不行:
Excel.Worksheet activeSheet = ((Excel.Worksheet)Application.ActiveSheet);
activeSheet.Cells[0, 0] = text;
我需要采用第二种方式,因为我需要使用rowIndex和colIndex进行循环。我该怎么做?
我收到了以下错误信息:
“System.Runtime.InteropServices.COMException”类型的未经处理的异常在mscorlib.dll中发生。其他信息:HRESULT: 0x800A03EC。