Write Cell: COM object that has been separated from its underlying RCW cannot be used


I am using UiPath Studio

In one sequence, I am using an Excel Application scope to open an excel file, assign a handful of variables, then close the workbook.

In the next separate sequence, I use “Use Excel File” with “Excel For Each Row” to iterate on the specified worksheet. Once it gets to a “Write Cell” dialogue, it throws the subject error:

“Write Cell: COM object that has been separated from its underlying RCW cannot be used”

I’ve combing through the forum and tried many things but am at a loss.

Any recommendations?


if you can use Modern Excel activities : ExcelProcessScope anf UseExcelFile, it’s better to use them.
More specific, put ExcelProcessScope outside the loop and put UseExcelFile inside the loop, as the following.

Note: as there might be zombie excel process, kill all excel processes using TaskManager of OS or reboot OS, in advance.

Or if it’s difficult to use ModernExcel activiites, can you try to use KillProcess and a few second Delay activity as the following?


@Yoichi Thank you for this. Where do I find ModernExcel activities? I can’t find that as a package and inherently I don’t have “Excel Process Scope”.


I accidentally found a way to make this work. I only included the “Read Range” activity within the “Excel Application Scope” which created the data table needed to get dt.RowCount.

Once I assigned the other variables, the Use Excel File activity worked just fine.

Thanks for your help!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.