Determine if a File Exists Using the Windows API

Category:
Files and Directories
Type:
Snippets
Difficulty:
Intermediate
Author:
Waty

Version Compatibility:

More information:
Using the DIR function may not be the best way to determine if a file exists, especially if you are using VB to compare two directories, and take action when the files do not match. This function, using the Windows API, offers an alternative.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: