DIAdem Help

Method: FileExists for FileSystemObject

  • Updated2024-09-12
  • 1 minute(s) read

Method: FileExists for FileSystemObject

Checks whether a file exists.

bFileExists = Object.FileExists(FileSpec)
ObjectFileSystemObject
Object with this method
FileSpecString
Specifies the path of the file.
bFileExistsBoolean
If the file exists, the value is True. If the file does not exist, the value is False.

The following example checks whether a file exists:

Function FileStatus(sFile)
  Dim fso, sOutput
  Set fso = CreateObject("Scripting.FileSystemObject")
  If (fso.FileExists(sFile)) Then
    sOutput = sFile & " exists."
  Else
    sOutput = sFile & " doesn't exist."
  End If
  FileStatus = sOutput
End Function

Log in to get a better experience