Search Tools Links Login

A Beginner method to check whether a file exists


Visual Basic 6, or VB Classic

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

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 136 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.