"Benjamins via AccessMonster.c om" <u39077@uwewrot e in message
news:7dfcc9c1e6 545@uwe...
Hi,
I have used CreateObject("S cripting.FileSy stemObject") to get the disk
volume.
Is there any other way of get the disk volume other than using the FSO.
Thanks
--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200801/1
You can retrieve this info from the windows API. Paste the following code
into a new module:
Private Declare Function GetVolumeInform ation Lib "Kernel32" _
Alias "GetVolumeInfor mationA" (ByVal lpRootPathName As String, _
ByVal lpVolumeNameBuf fer As String, ByVal nVolumeNameSize As Long, _
lpVolumeSerialN umber As Long, lpMaximumCompon entLength As Long, _
lpFileSystemFla gs As Long, ByVal lpFileSystemNam eBuffer As String, _
ByVal nFileSystemName Size As Long) As Long
Public Function DriveSerial(Dri veLetter As String) As String
Dim Serial As Long, dummy As String
dummy = String$(255, Chr$(0))
GetVolumeInform ation DriveLetter & ":\", _
dummy, 255, Serial, 0, 0, dummy, 255
DriveSerial = CStr(Serial)
End Function
Then call like this:
Debug.Print DriveSerial("C" )