cancel
Showing results for 
Search instead for 
Did you mean: 

Handling of "File In Use" Message in Word

AndreKöpplin
Level 5
Hello Blue Prism Community I have one Process Automation, which have to open an Word Document to gather information from the Word Document. Unfortunately, some of the business users forgot to close their Documents after they provide the documents to the Robot. The Robot stops his work, because he isn't able to handle the "File In Use" Message in Word (attach). Could someone give me an advice how I can handle this Message box/Problem? Furthermore, if the Document is in use by someone, BP add the document twice to the Workqueue. First Item with the correct title e.g "TESTDocument.doc" and the second as "~$STDocument.doc". I want to have that the Robot ignore such as documents. I am working know on BPv6.4 and Windows 10.   Thanks in advance for you support and feedback. BR Andre
3 REPLIES 3

david.l.morris
Level 14
Not sure if this is what you're looking for or not, but I always have the process check for a lock file before opening Word documents, Excel workbooks, etc. Just as you mentioned there is a second file with the same name but begins with ~$. I usually first do File Exists for the [Folder Path] & [File name] ...followed by a decision stage to determine whether to throw an error if the file does not exist. ...followed by File Exists again but this time for [Folder Path] & "~$" & [File name] ...followed by a decision stage to determine whether to throw an error if the lock file exists, indicating that someone else has the file open. This may not be perfect, but it has never failed for me.   The other option (which I have not attempted because I don't prefer it) is to create a copy of the file before opening it. You'd check to see if the file is there and then check to see if there is a lock file for it as well. If there is a lock file, then you copy the file into the same folder with a new name. Then open the new file, get the data, and do whatever you need to. Then either archive or delete the new file afterward. The problem with this method is that it doesn't work if you need to write data inside the file. It would really only be useful if you're only reading from the file.
Dave Morris 3Ci at Southern Company Atlanta, GA

AndreKöpplin
Level 5
Hello David Thanks a lot for your support. I was able to find with your tip a solution for my Problem. Best regards Andre

AndreyKudinov
Level 10
You can also open file read only if you are not changing it in any way and supress possible alerts temporarily.