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


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


@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