Change the Volume Label of a Disk


Question

Change the Volume Label of a Disk in Access by VBA Code ? I just can Get the Volume Label from a disk , but how can I set the volume label of a disk ?

Answer

From: Shamil Salakhetdinov <shamil@marta.darts.spb.ru>
Subject: Re: Change the Volume Label of a Disk
Date: 12 March 1999 11:29

Christopher,

Try enclosed code.

HTH,
Shamil

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

Sub SVL_Test()
  Dim strRootPathName As String
  Dim strNewVolumeLabel As String

  strRootPathName = "a:\" & vbNullString
  strNewVolumeLabel = "NewLabel" & vbNullString
  SetVolumeLabel strRootPathName, strNewVolumeLabel
End Sub

HOME    TOPICS

Copyright © 1999 by Shamil Salakhetdinov.
All rights reserved. Terms of use.

Last updated: October 10, 2006

Published also here at 4TOPS: Change the Volume Label of a Disk