Method: GetDrive for FileSystemObject
- Updated2024-09-12
- 1 minute(s) read
FileSystemObject and Dictionary > Methods > Method: GetDrive for FileSystemObject
Method: GetDrive for FileSystemObject
Returns a drive object that is associated with a path.
Set oDrive = Object.GetDrive(DriveSpec)
| Object | FileSystemObject Object with this method |
| DriveSpec | String Specifies the drive name. |
| oDrive | Drive Returned object |
The following example returns a drive object:
Function GetDriveObject(sPath) Dim fso Set fso = CreateObject("Scripting.FileSystemObject") Set GetDriveObject = fso.GetDrive(fso.GetDriveName(sPath)) End Function