comexceptionHRESULT:0x800A03EC

我写复制表的ac#程序。 当我调用WorkSheet.Copy方法直到105次时,我得到exception错误(0x800A03EC)。 这是我的代码片段:使用Microsoft.Office.Interop.Excel;

private void CreateSheet(string dst_fileName) { object cell1 = "A2"; ApplicationClass app = null; Workbook book = null; Worksheet sheet = null; Worksheet sheet_to_copy = null; int i=0; try { app = new ApplicationClass(); app.Visible = false; app.ScreenUpdating = false; app.DisplayAlerts = false; book = app.Workbooks.Open(dst_fileName, 0, false, 5, "", "", true, XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0); // Reference to the worksheet sheet_to_copy = (Worksheet)book.Worksheets[1]; for(;i<listViewPrg.Items.Count;i++) { sheet = (Worksheet)book.Worksheets[book.Worksheets.Count]; // Copy the worksheet to the end of the worksheets sheet_to_copy.Copy(Missing.Value, sheet); sheet.Name = "NewSheet(" + book.Worksheets.Count + ")"; } book.SaveAs(dst_fileName, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, XlSaveAsAccessMode.xlNoChange, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { QuitExcel(app); } } 

我找不到任何解决办法。 有人能给我一个提示来解决这个问题吗? 非常感谢。

可能你有一些损坏的Excelregistry项或左右?

你为什么不尝试使用excel文件的开源阅读器,并使用它们做一切事情? 速度会飞快,我保证你不会得到这些错误!