Excel throws an error when repeatedly accessing same file

We have found out during tests that an error occurs in debug mode when trying to repeatedly access the same excel file.
This started to happen after old pc’s were replaced with new, faster ones. The tests are run one by one and they all access the same file.
It seems that excel is being accessed, closed and when another tests starts and wants to access the same file, excel file is not yet properly closed giving an error.
The error is hard to reproduce as it happens only from time to time. Excel process scope is used so excel closes automatically and as far as I know there is no modern activities which can close excel file.

I know that this is given as a solution to one of the patterns but should we simply mix the modern and classic activites? I know that there is no limitation to this so we can flexibely use either but it does not seems like a best practice to me.

Studio version: 2022.10.5
Excel activities version: 2.16.2

There are two patterns for this error:

Pattern 1

21:11:53.4234 => [ERROR] [UiPath.Studio.App.Logging.OutputLogger] [96] Setting Excel Process Scope: Access is denied.
21:11:53.4375 => [ERROR] [UiPath.Studio.App.Logging.OutputLogger] [96] Read configuration: Access is denied.

After retry(debug action) everything works as normal and tests progresses and finished.


22:00:34.9238 => [ERROR] [UiPath.Studio.App.Logging.OutputLogger] [71] Excel process scope: Launched object disconnected from client. (0x80010108 (RPC_E_DISCONNECTED))

If you use retry on this, the next erro will occur:

22:02:27.3255 => [ERROR] [UiPath.Studio.App.Logging.OutputLogger] [42] 範囲を読み込み: COM object that has been separated from its underlying RCW cannot be used.

After this error appears, Studio cannot be restored to normal state and we need to restart the tests.

Could you please share screen shorts.

Pavan Kumar

Hello @GT_Ropa
Use kill process with Process name “Excel”. Check the continue on error property.
Use this above the Excel process after the 2-3 second delays


It’s just error that comes up on the start of 「excel process scope」or 「use excel file」activity.


Thanks for the advice! I was rather looking for a long term solution.
As far as I remember in classic you could get the excel handle and close it (or maybe it was in Blue Prism). This is on my list of “nice to have” functionalites.
But rather than that, it would be helpful to make the activity a little bit smarter (check if excel was properly closed before exiting「use excel file」scope) or have the same property as in 「use application/browser」to choose whether you want to close excel or not.
Killing the process is optimal for UR but in AR it may cause a lot of problems since people may have other excel processess open at the time.