excel vba check file exist code example
Example: 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
' Existence of a file
If Dir("C:\myDirectory\myFile", vbDirectory) = vbNullString Then
MsgBox "Doesn't exists"
Else
MsgBox "Exists"
End If