The FileSystemObject VBA GetDriveName function returns a string with the name of the drive for the specified path.
- BuildPath
- CopyFile
- CopyFolder
- CreateFolder
- CreateTextFile
- DeleteFile
- DeleteFolder
- DriveExists
- FileExists
- FolderExists
- GetAbsolutePathName
- GetBaseName
- GetDrive
- GetDriveName
- GetExtensionName
- GetFile
- GetFileName
- GetFolder
- GetParentFolderName
- GetSpecialFolder
- GetTempName
- MoveFile
- MoveFolder
- OpenTextFile
VBA GetDriveName Syntax
1 | fso.GetDriveName( path ) |
path
The path for which the drive name is supposed to be specified.
VBA GetDriveName Examples
1 2 3 4 5 6 7 | Set fso = CreateObject( "Scripting.FileSystemObject" ) fso.GetDriveName( "C:\Src" ) 'Result: C: fso.GetDriveName("C:\") 'Result: C: fso.GetDriveName( "D:\SomeFolder\SubFolder" ) 'Result: D: |