How can u test too see if a file exists in VBA?

  • Thread starter Thread starter dee
  • Start date Start date
D

dee

How cab you check to see if a file exists?
There is FileDateTime(fname) but this generates an error
when the file doesnt exist.
Thanks
 
I got these from previous posts
In a macro
Condition Action
Len(Dir("C:\...))<2 Msgbox
... StopMacro

In code
If Dir("PathToFile") = "" Then
'the file does not exist
Else
'the file does exist
End If

Chris
 
Chirs

NEAT IT WORKS GREAT.
THAAAAAAKS


Chris Reveille said:
I got these from previous posts
In a macro

In code
If Dir("PathToFile") = "" Then
'the file does not exist
Else
'the file does exist
End If

Chris
 
Back
Top