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

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
 
C

Chris Reveille

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
 
D

dee

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
 
Top