【发布时间】:2010-03-10 22:37:02
【问题描述】:
当我运行以下代码时,出现以下异常:
''# NOTE: ExcelApp is a Private main form variable
Dim ReportBooks As Excel.Workbooks = ExcelApp.Workbooks
Dim ReportBook As Excel.Workbook = ReportBooks.Open(localFilename)
Dim ReportSheet As Excel.Worksheet = ReportBook.Sheets("Report")
''# Retreive data from sheet
ReleaseCOM(ReportSheet)
ReportBook.Close(True) ''# Error raised here
ReleaseCOM(ReportBook)
ReleaseCOM(ReportBooks)
ERROR: COMException was unhandled The object invoked has disconnected from its clients. (Exception from HRESULT: 0x80010108 (RPC_E_DISCONNECTED))
注意:所有数据似乎都已正确检索。
请帮助我诊断并解决此错误。
【问题讨论】:
标签: vb.net excel interop com-interop excel-interop