newman     VBWeb     VBSource     Portfolio    

FileExists

ErrMsg

TOP TEN

IsLButtonDown
Returns the boolean value True if the named file exists.
Syntax
If FileExists(FileName) Then ...
FileName - Required text argument that specifies the name of the file. Use a complete path specification either absolute or relative.

Source
Function FileExists(ByVal FileName As String) As Boolean
    Dim hFile As Long
    
    hFile = FreeFile
    On Error GoTo Trap
    Open FileName For Input As hFile
    On Error GoTo 0
    Close hFile
    FileExists = True
    Exit Function
    
Trap:
    If Err.Number <> 53 Then 'File not found.
        Err.Raise Err.Number, , Err.Description
    End If
    FileExists = True
    Exit Function
End Function
	


Feedback Comments
Return Address (if you want a reply)


Copyright 1997 NEWMAN Services Corp. All rights reserved.
973-228-5753 pres@newmanservices.com
DECONSTRUCT THIS PAGE