ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Excel 2007 VSTO - Why do I get 0x80010105 upon Excel.Close()? (https://www.excelbanter.com/excel-discussion-misc-queries/265515-excel-2007-vsto-why-do-i-get-0x80010105-upon-excel-close.html)

senglory

Excel 2007 VSTO - Why do I get 0x80010105 upon Excel.Close()?
 
From time to time (not an each run, but 5th or 6th in a row) I get the following exception at the last line in the code:

Microsoft.Office.Interop.Excel.Workbook wbNew = _ExcelApp.Workbooks.Add(Type.Missing);
wsResults.Copy(Type.Missing, wbNew.Worksheets[3]);
wbNew.SaveAs(string.Format("SummaryView-{0}-{1}.xlsx", segmentId, year),
XlFileFormat.xlOpenXMLWorkbook, Type.Missing, Type.Missing, Type.Missing, Type.Missing, XlSaveAsAccessMode.xlShared, Type.Missing, Type.Missing, Type.Missing
, Type.Missing, Type.Missing);
wbNew.Close(false, Type.Missing, Type.Missing);



System.Runtime.InteropServices.COMException: The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT)).


Why do I get it and how to fix the problem?


All times are GMT +1. The time now is 02:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com