How to open two Excel Files at the same time, without having HRESULT problems

I have been long wondering how can I solve this problem. I have this excel file with multiple sheets that I loop into. At the start of the process, I would get the Workbook App var to get all the sheets. Add a for each loop for all the sheets, then process it. Inside the said process, I need to open an another excel file for copying of the templates and to put the append details. At the end of the loop, I put an close workbook activity.

My problem is, I sometime, before I open the another excel file for template. I get an error of HRESULT: 0x80010108 Which can be solve( I think) by killing the Excel process. I did this before but it would also kill the background process of reading each sheet, that would give me an error for
For each Sheet in WBMainFile: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
Which I think occurs since it can’t get the other sheet from the excel file, as it has been closed my kill excel.

This works sometimes, but I don’t really get what’s causing these problems. I hope you can help me, thank you.

Once I tried this using the batch script.

Give a try opening the Excel file using the cmd bat file


Did we try with a simple way of reading the excel file with READ RANGE from WORKBOOK activities instead of excel

Cheers @Archie

Sorry for the very late replay, I haven’t tried it before. I tried putting a 3 sec delay between the excel app and it seems to work now. Problem is, I am getting a new error for some reasons. Reading the the first exec scope gives me an error of

Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))

I am not sure if it is anything related to the delay, cause this is the first time that I encountered this problem.

I would like to suggest still the read range from workbook where mostly we won’t face these issues while reading excel file or any workbook

Adding delay is fine but considering bot performance it is always good to avoid delay as much as possible
Instead we can use a KILL PROCESS activity with ProcessName as Excel and then use READ RANGE under workbook activities

That should work for sure

Cheers @Archie