Excel Interop Workbooks.Discover inconsistencies

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?

0
source share
1 answer

RPC_S_CALL_FAILED , question xxbbcc, .

, . googled RPC_S_CALL_FAILED excel SuperUser

"FoxitReader PDF Creator COM" , , .

: Excel > > > > , " COM" > . .

+1

Source: https://habr.com/ru/post/1780888/


All Articles