VolumeName property

Sets or returns the volume name of the specified drive. Read/write.

Syntax

object.VolumeName [= newname ]

The VolumeName property has these parts:

Part Description
object Required. Always the name of a Drive object.
newname Optional. If provided, newname is the new name of the specified object.

Remarks

The following code illustrates the use of the VolumeName property.

Sub ShowVolumeInfo(drvpath)
    Dim fs, d, s
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set d = fs.GetDrive(fs.GetDriveName(fs.GetAbsolutePathName(drvpath)))
    s = "Drive " & d.DriveLetter & ": - " & d.VolumeName
    MsgBox s
End Sub

See also

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.