Make your own free website on Tripod.com
Change Drive/Disk Label

Preparations

Add 1 Command Button (named Command1) to your form.

Module Code

Declare Function SetVolumeLabel Lib "kernel32" Alias "SetVolumeLabelA" (ByVal _
lpRootPathName As String, ByVal lpVolumeName As String) As Long

Form Code

Private Sub Command1_Click()
'replace the "d:\" below with the drive you want to change its label
'replace the "MyNewLabel" below with the drive new label
   
If SetVolumeLabel("d:\", "MyNewLabel") = 0 Then
       
MsgBox "An Error occured while trying to change drive label", vbCritical, "Error"
    End If
End Sub

Go Back