In this video I demonstrate and discuss two of the most common approaches that can be employed in VBA coding to determining if a file exists:
• DIR
• File System Object (FSO)
Using either approach, with a single line of VBA code, you can now determine if a given file is found on your file system, or not.
I also touch upon implementing Self-Healing Object Variables (SHOV) when using FSO to get a performance boost. So in my opinion, SHOVs should be a best practice when using FSO.
Although Dir and FSO are the most commonly used techniques, since publishing this video, I've added several more approaches to my supporting article for the sake of completeness. Be sure to check out the Speed Comparison section of the article, the result may surprise you!
Article(s) on this Subject:
• https://www.devhut.net/vba-determine-...
Detailed FSO Resource:
• https://www.devhut.net/vba-fso-files-...
Self-Healing Object Variable Resource:
• https://www.devhut.net/self-healing-o...
Other Useful Links:
• https://learn.microsoft.com/en-us/off...
• https://learn.microsoft.com/en-us/off...
My Links:
• https://www.cardaconsultants.com/ (business)
• https://www.devhut.net/ (blog)