I have multiple instances of Stata accessing the same excel file to record some information. Every once in a while they try to access the excel file at the exactly the same time and I get following error:
file C:/…/MaxMin.xlsx could not be loaded
r(603);


What I need is to check first if the file is being accessed by another instance and if it is sleep 5-10 seconds and retry. If not, proceed to write to the file.
However, I have no experience with file commands I usually see in program files. Can anyone provide some guidance?