Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ensure a file exists
Message
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00568676
Message ID:
00568702
Views:
12
>How do i check to be sure a file exists before I open it?
>
>I see the GetAttr() function, but I get an error of the file is
>not there.
>
>Thanks

You can also check with the Dir() function:
If Dir("C:\Myfile.ext") <> "" Then
   ' .. code to open the file
Else
   ' .. display message that the file could not be found
End If
Dir() returns an empty string if it couldn't find the specified file.
Previous
Reply
Map
View

Click here to load this message in the networking platform