Function fIsFileDIR(stPath As String, _
Optional lngType As Long) _
As Integer
'Fully qualify stPath
'To check for a file
' ?fIsFileDIR("c:\winnt\win.ini")
'To check for a Dir
' ?fIsFileDir("c:\msoffice",vbdirectory)
'
On Error Resume Next
fIsFileDIR = Len(Dir(stPath, lngType)) > 0
End Function
Set fso = CreateObject("Scripting.FileSystemObject")
Filename = "c:\aaa\bbb.txt"
If fso.FileExists(Filename) Then
MsgBox ("FILE,EXIST")
Else
MsgBox ("NOFILE")
End If