Exception HRESULT: 0x800AC472 (Excel out of scope)

I have looked around this forum but can’t seem to find a solution to my error. I have a simple program: excel application scope, read a range, do some vb, close the workbook and write it back into the worksheet. The FIRST time I try running the program I get this Excel out of scope error, however when I rerun the program it works fine.

Does anybody know why this might happen? The file that I am working with is a .xlsx file that is emailed to me daily and I drag it into my desktop without ever opening it if that makes a difference.

I think when you run for the first time excel sheet was already opened

I’ve double checked just now and the file is closed when running. Still got the error

1 Like

check the task manager, any Excel service is running or the excel format must be .xlsx or .csv

3 Likes

@mkkajtez You can try this at the beginning of the bot use kill process in the following link you can download file so it will close all the excel which are opened

Hi,
I did have similar HRESULT exception while accessing Excel object through Excel scope activity and the issue is random and sporadic. In my case, there is a master excel which has an external connection through Pivot data source to another child excel. If the child excel is opened by one excel scope and then if we try to open and perform activities on the master excel (Even after few seconds delay), it throws this exception. The fix in this case was to close the child excel after performing any operations and then open up the master excel. By this, the second excel scope has the child excel internally ready and available through the master excel. Thought of sharing this behavior of Excel application scope, though it may not be a fix in your case.

4 Likes

I killed the excel service in task manager and ran again, it works good now. Thanks

@mkkajtez and anyone who finds this forum,

You may want to check your connection to any Excel file(s) you are working with. Specifically, if you are working from a share drive or Microsoft OneDrive. If your connection is slow or interrupted it may cause your workflow to throw this error. I got this error intermittently after running the same workflow for months, I put the Excel files on a local drive and it fixed all my issues. Never threw this error again.

Just something to try if you get stumped.

3 Likes

I can back up what @kevstu02 said. I recently migrated my UiPath Studio to a new higher perf laptop. While doing so I did install the latest studio and migrated the license. Both my older laptop and the new had the UiPath project on the same MS OneDrive location, and on the old laptop it worked perfectly, while on the new laptop I had all sorts of issues, among others the excel process hanging in the background and locking a file, plus the bogus HRESULT: 0x800AC472 error that got me to this forum page. I copied the project to a drive that was not scoped by OneDrive and the automation started working flawlessly.

Point is: this error seems to have been introduced with the latest release, as the 2019.5.0 did not have this, while 2019.10.2 does have this error. Something for UiPath folks to consider…

4 Likes

There is an office activation problem. Try open empty excel, and then run studio