Excel.Application objExcel = null;
Excel._Workbook objBook = null;
objExcel = new Excel.Application();
objBook = objExcel.Workbooks.Open(@"D:\表样.xls", objMissing, objMissing, objMissing, objMissing, objMissing, objMissing, objMissing, objMissing, objMissing, objMissing, objMissing, objMissing, objMissing, objMissing);
Excel._Worksheet oldsheet = (Excel._Worksheet)objBook.Worksheets[1];
Excel.Application newExcel = new Excel.Application();
Excel.Workbook newbook = newExcel.Workbooks.Add(true);
Excel.Worksheet newsheet = newbook.Sheets[1] as Worksheet;
//设置禁止弹出保存和覆盖的询问提示框
newExcel.DisplayAlerts = false;
newExcel.AlertBeforeOverwriting = false;
oldsheet.Copy(objMissing, newsheet); //这里出错 “ 异常来自 HRESULT:0x800A03EC”
newbook.Save();
newExcel.Save(@"c:\助学.xls");
newsheet = null;
newbook = null;
newExcel.Quit();
newExcel = null;
异常来自 HRESULT:0x800A03EC
这个就是想复制多个表的SHEET到新创建的EXCEL里,或都大家有什么好的方法可以实现要求带格式一起复制过去
http://www.ureader.com/message/692318.aspx
1.权限问题。可在控制面板----Administrative Tools----Component Services---Dcom config里面开放权限
2.你的office没有注册,或者没有激活。
楼主是怎样解决的,能否指教一下