troubleshooting Question

checking if a file is in use by another process

Avatar of YZlat
YZlatFlag for United States of America asked on
Visual Basic Classic
2 Comments1 Solution890 ViewsLast Modified:
when attempting to open a file, I should check if the file is being used by another process.
If it is, then I want to make several attempts to open it. If it is still not accessible, then the program should terminate
Here is the code for opening a file:

 Set objFSO = CreateObject("Scripting.FileSystemObject")
 Set objTS = objFSO.OpenTextFile(strFileName, ForAppending, True)

how do I programmatically check if file is in use and make several attempts to open it if it is?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros