A Beginner method to check whether a file exists
![Visual Basic 6, or VB Classic Visual Basic 6, or VB Classic](https://www.fortypoundhead.com//assets/img/icons/v7/vb6.png)
A Beginner method to check whether the file exists or not. Simple and should able to run on different Window OS.
Original Author: Jacky Wong
Code
Public Function CheckFile(InFileName As String) As Boolean
On Error GoTo ErrHandler
CheckFile = False
If Dir(InFileName) <> "" Then
If (GetAttr(InFileName) And vbDirectory) = 0 Then
CheckFile = True
Else
MsgBox "File doesn't exist!", vbCritical
Exit Sub
End If
Else
MsgBox "File doesn't exist!", vbCritical
Exit Sub
End If
ErrHandler:
End Function
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.