The FileSystemObject VBA GetDrive returns a Drive object based on the specified.
VBA FileSystemObject Methods
- 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 GetDrive Syntax
fso.GetDrive( path )
path
A path that you want to convert to unambiguous file and folder.
VBA GetDrive Examples
Set fso = CreateObject("Scripting.FileSystemObject") Set d = fso.GetDrive("C:") 'Now you can use the Drive object to get drive properties such as below Debug.Print d.AvailableSpace 'Available space on drive Debug.Print d.DriveLetter 'Result: "C:" Debug.Print d.DriveType Debug.Print d.FileSystem Debug.Print d.FreeSpace Debug.Print d.IsReady Debug.Print d.RootFolder Debug.Print d.SerialNumber Debug.Print d.ShareName Debug.Print d.TotalSize Debug.Print d.VolumeName