【发布时间】:2009-05-13 05:22:24
【问题描述】:
为什么会这样:
((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
【问题讨论】: