Function File Operations Class

FileExists

Determine if the named file exists. Function returns True if the file exists. Function returns False if the file does not exist OR there was an error.

Signature (Visual Basic / VBA)

Public Function FileExists( _
      ByVal vFileName As Variant _
    , Optional ByVal vAttributes As Variant _
    ) As Boolean

Code Example

    FileExists("C:\COMMAND.COM") = True
    FileExists("C:\FILE0000.CHK") = False

Parameters

Parameter Description
vFileName Name of the file or directory that will be checked for existence. Function returns False if vFileName is Null or cannot be fixed-up to a String. vFileName can contain the DOS Wildcard characters "*" and "?".
vAttributes One or more of the vb constants vbNormal, vbHidden, vbSystem, vbVolume, and vbDirectory describing the allowable types of files. vAttributes defaults to vbNormal if it is missing or Null or cannot be fixed-up to a number.