vba fileexists code example
Example 1: vba check if file exists
Public Function IsFile(s)
IsFile = CreateObject("Scripting.FileSystemObject").FileExists(s)
End Function
Example 2: excel vba existence of a file
' Existence of a file
If Dir("C:\myDirectory\myFile", vbDirectory) = vbNullString Then
MsgBox "Doesn't exists"
Else
MsgBox "Exists"
End If