How can I determine if a file exists?

PRD

Registered User.
Local time
Today, 15:18
Joined
May 18, 2011
Messages
72
Hello, I would like to check if a file exists before I process it. Is there a command or routine I could run which would determine the existence of a file if I provide it with a path\filename, e.g. "C:\Photos\01234.jpg"? Thank you.
 
fileexists = dir("yourpath")<>""
 
G37Sam -

Just a follow-up for what its worth, if you change the property of 'sPath' from 'String' to 'Variant' the macro will not blow up with an 'Invalid use of the Null' error if an invalid path is used. Otherwise this is really a great and useful subroutine - a real life-saver. Thanks again.
 

Users who are viewing this thread

Back
Top Bottom