"Benjamins via AccessMonster.com" <u39077@uwewrote in message
news:7dfcc9c1e6545@uwe...
Hi,
I have used CreateObject("Scripting.FileSystemObject") 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.com
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 GetVolumeInformation Lib "Kernel32" _
Alias "GetVolumeInformationA" (ByVal lpRootPathName As String, _
ByVal lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long, _
lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long, _
lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, _
ByVal nFileSystemNameSize As Long) As Long
Public Function DriveSerial(DriveLetter As String) As String
Dim Serial As Long, dummy As String
dummy = String$(255, Chr$(0))
GetVolumeInformation DriveLetter & ":\", _
dummy, 255, Serial, 0, 0, dummy, 255
DriveSerial = CStr(Serial)
End Function
Then call like this:
Debug.Print DriveSerial("C")