Be the first user to complete this post

  • 0
Add to List

FileSystemObject : FileExists Method

Description: 

Returns True if a specified file exists; False if it does not.

Format : 

objectOfFileSystemObject. FolderExists(fileName)

objectOfFileSystemObject : As the names says, it’s a FileSystemObject.

Arguments: 
  • fileName
    • Mandatory
    • Type:     String
    • File , whose existence to be determined.
Function FnIsFileExist(strCompleteFilePath)
      Set fso = CreateObject("Scripting.FileSystemObject")
      If fso. FileExists(strCompleteFilePath)Then
                    strStatus = strCompleteFilePath & “  file exists”
            Else
                    strStatus = strCompleteFilePath & “  file does not exist”
           End If
        FnIsFolderExist = strStatus
End Function

Msgbox FnIsFileExist ("c:\New Folder\file.txt")



Also Read:

  1. FileSystemObject:OpenTextFile Method
  2. FileSystemObject : MoveFile Method
  3. FileSystemObject : FolderExists Method
  4. FileSystemObject : DeleteFolder Method
  5. FileSystemObject : CreateTextFile Method
  6. FileSystemObject : DeleteFile Method
  7. FileSystemObject : GetDriveName Method
  8. FileSystemObject : CopyFolder Method