If Dir("c:\mypath\myfile.txt") = "" Then 'code to indicate the file does not exist Else 'code to work with the file EndifAlthough not a VB command or function, you can use the FileSystemObject also and it does have the FileExists() function that returns True/False if the file exists or not. Add a reference to the MS scripting runtime and then do something like:
Dim FSO as Scripting.FileSystemObject Set FSO = New Scripting.FileSystemObject Debug.Print FSO.FileExists("C:\mypath\myfile.txt")Hope this helps.