Method: GetDriveName for FileSystemObject
- Updated2024-09-12
- 1 minute(s) read
FileSystemObject and Dictionary > Methods > Method: GetDriveName for FileSystemObject
Method: GetDriveName for FileSystemObject
Returns the part of a path that corresponds with the name of the drive.
sGetDriveName = Object.GetDriveName(Path)
| Object | FileSystemObject Object with this method |
| Path | String Specifies the path. The path must neither correspond with an existing folder nor with an existing file. |
| sGetDriveName | String Receives the name of the drive. |
The following example specifies the filename of a drive in a path:
Function GetDrive(sDrive) Dim fso Set fso = CreateObject("Scripting.FileSystemObject") GetDrive = fso.GetDriveName(sDrive) End Function