Function FileExists(stFile As String) As Boolean If Dir(stFile) <> "" Then FileExists = True End Function
Sub TestForFile() Dim myFileName As String
myFileName = "c:\SalesData1.xls" If FileExists(myFileName) Then
MsgBox myFileName & " exists"
Else
MsgBox myFileName & " does not exist" End If End Sub