How to stop a robot when file is opened by others?



I want to stop a robot’s execution when the robot tries to open an excel file
placed on a shared server which is already opened by someone else.

Right now, when the excel file that the robot tries to open is already opened,
the robot automatically makes a copy of the file and starts writing into the copied file.
I don’t want the robot to do that, I’d like the robot to stop when it faces this problem.

Somebody have a clue about how I can solve this?


Before opening excel, use kill process activity and name as excel, so that if any open excel will be closed.


If you use workbook activities instead of excel activities, if the excel is already open by someone it will throw an error “Write cell : The process cannot access the file ‘Filepath.xlsx’ because it is being used by another process.” and execution will stop.