Be the first user to complete this post

  • 0
Add to List

FileSystemObject : DriveExists Method

Description: 

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

Format : 

objectOfFileSystemObject. DriveExists(DriveName)

  • objectOfFileSystemObject : As the names says, it’s a FileSystemObject.
Arguments: 
  • fileName
    • Mandatory
    • Type:     String
    • Drive name , whose existence to be determined.

Function FnIsDriveExist(strDriveName)
      Set fso = CreateObject("Scripting.FileSystemObject")
      If fso. DriveExists(strDriveName)Then
                    strStatus = strDriveName & “  drive exists”
            Else
                    strStatus = strDriveName & “  drive does not exist”
           End If
        FnIsDriveExist = strStatus
End Function

Msgbox FnIsDriveExist ("c")



Also Read:

  1. FileSystemObject : GetFileVersion Method
  2. VBA-Excel: Add/Insert multiple objects from a folder in an Excel Document.
  3. FileSystemObject : GetParentFolderName Method
  4. FileSystemObject : MoveFile Method
  5. FileSystemObject : MoveFolder Method
  6. FileSystemObject : GetDriveName Method
  7. FileSystemObject : GetAbsolutePathName Method