Use Excel File: COM object that has been separated from its underlying RCW cannot be used

Hi i am getting this error. Please someone help me to solve it

1 Like

Hi @Sirisha_Siri ,

Could you check and verify whether you are not reading the same Excel Spreadsheet again?

Kind Regards,
Ashwin A.K

1 Like

Hi @Sirisha_Siri

One possible reason is that the object has been instantiated on one thread and another thread is trying to use it and causing the failure.

Kindly try to kill the excel or close the workbook before that use excel file

2 Likes

In my case, I was using Excel scope, Use excel file inside for loop. So it opened the excel thread in every iteration. Now I have placed the for loop inside the Excel scope/use excel file. It has removed this error. Pls check for similar scenario in your code.

3 Likes

This error can also be caused by using both activities Excel Application Scope and Use Excel File

6 Likes

In my case, I was using ExcelProcess scope/Use Excel file/ for each excel row then invoking a Workflow that opened an use excel file with a Single Scope Application.

Solution was to change Single Scope Application → Excel Process Scope and setting the property “Process Mode” to “Always create new”.

Explanation: Second excel file was opened reusing same thead, so, when going out of the Incoke and trying to use the For each excel row loop variable, it was not present anymore.

3 Likes