Not a Member Yet,
Click here to Register
How do you like the new design?






ID: 323
Viewed: 2467
Added: Aug 19, 2002
Version:
Snippet uploaded by: snippet
Written By: Unknown
Demo: Sorry, no demo



User Rated at: 0 Stars
Rate This:

Thank you for your vote. Please wait...

It appears you already voted for this snippet

It appears your vote value was empty

How to check if a file exists

Highlight all by clicking in box
<!---Declaration--->
none

Highlight All
<!---Code--->
'Example code to check for file existence
If FileExists(App.Path + "test.dat") Then
Open App.Path + "test.dat" For Random As #1 Len = 100
Else
MsgBox "The file '" + App.Path + "test.dat' does not exist.", vbCritical + vbOKOnly, "File not found"
End If


'Put this Function in BAS module
Public Function FileExists(FileName As String)
On Error Resume Next
FileExists = (Len(Dir(FileName)) > 0)
End Function;


No Comments to show

Please completely fill out the form below if you want to review this snippet. All reviews are subject to validation.


Replying to a Comment...


Adding your comment. Please wait...

Thanks for adding your comment!. After further review it will be added.

There was a problem adding your comment. Please try again.

Please complete all the fields in the form before sending.

© 2002 - 2017 snippetlibrary.com All Rights Reserved. Conditions