Hi, How can I check if file exists in my app's directory? Thanks.
Thanks Tomexx.
Use the Dir$ function. Code: If Dir$("MyFile.txt") <> "" Then Print "File exsist" Else Print "File does not exsist" End If
If Dir$("MyFile.txt") <> "" Then Print "File exsist" Else Print "File does not exsist" End If
Though it might be overkill, you can use the FileExists method of the File System Object. First declare a reference to the Microsoft Scripting Runtime Library. Code: Dim fso As New FileSystemObject Dim bFileExists as Boolean bFileExists = fso.FileExists(App.Path & "\MyFile.txt") Set fso = Nothing
Dim fso As New FileSystemObject Dim bFileExists as Boolean bFileExists = fso.FileExists(App.Path & "\MyFile.txt") Set fso = Nothing
Forum Rules