Property: VolumeName for Drive
- Updated2024-09-12
- 1 minute(s) read
FileSystemObject and Dictionary > Properties > Property: VolumeName for Drive
Property: VolumeName for Drive
Specifies the drive name.
Object.VolumeName
| Object | Drive Object with this property |
| Object.VolumeName | String with read and write access |
The following example generates a collection of all drives:
Function CreateDriveList Dim fso, oMyDrive, oMyDrives, sOutput Set fso = CreateObject("Scripting.FileSystemObject") Set oMyDrives = fso.Drives For Each oMyDrive in oMyDrives sOutput = sOutput & oMyDrive.DriveLetter & VBTab If oMyDrive.DriveType = 3 Then sOutput = sOutput & oMyDrive.ShareName ElseIf oMyDrive.IsReady Then sOutput = sOutput & oMyDrive.VolumeName Else sOutput = sOutput & "[Not ready]" End If sOutput = sOutput & VBCrLf Next CreateDriveList = sOutput End Function