I have a process that opens several books
var exApp = new Excel.Application();
Excel.Workbook ONE;
Excel.Workbook TWO;
Excel.Workbook THREE;
ONE = exApp.Workbooks.Open(ONELocation);
TWO = exApp.Workbooks.Open(TWOLocation);
THREE = exApp.Workbooks.Open(THREELocation);
Console.WriteLine("All Excel workbooks opened successfully\n");
Sometimes it starts without problems.
Sometimes, although I get the following exception on failure
System.Runtime.InteropServices.COMException: "Remote procedure failed. (Exception from HRESULT: 0x800706BE) '
The exception occurs in different books, and sometimes at all. When this happens after restarting several processes, the process is successful and all data is processed correctly.
Why does this work sometimes and not others? Is there a better way to open these books? How to stop this?
source
share