G
Guest
My question regarding code below is that I'm not sure how/where to place the code. At this point, the extent of my VBA experience is AUTO_OPEN and AUTO_CLOSE. I would like to call his code as the workbook is opening
How do I place the code? ...within AUTO_OPEN? ...called from AUTO_OPEN? ...do I create a standard module or class module or function and place the code there??? Appreciate any suggestions out there
Thanks, Warren R
--------------------------------------------------------
Here is the code to pull C: Volume Serial Number given to me from Rob van Gelder..
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 Lon
Sub test(
Const cMaxPath = 256, cDrive = "C:\
Dim strTemp As String, lngRet As Lon
Dim lngVolSerial As Long, strVolName As String * cMaxPat
Dim lngMaxCompLen As Long, lngFileSysFlags As Lon
Dim strFileSysName As String * cMaxPat
lngRet = GetVolumeInformation(cDrive, strVolName, cMaxPath, lngTemp,
lngMaxCompLen, lngFileSysFlags, strFileSysName, cMaxPath
strTemp = Format(Hex(lngTemp), "00000000"
strTemp = Left(strTemp, 4) & "-" & Right(strTemp, 4
MsgBox strTem
End Su
How do I place the code? ...within AUTO_OPEN? ...called from AUTO_OPEN? ...do I create a standard module or class module or function and place the code there??? Appreciate any suggestions out there
Thanks, Warren R
--------------------------------------------------------
Here is the code to pull C: Volume Serial Number given to me from Rob van Gelder..
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 Lon
Sub test(
Const cMaxPath = 256, cDrive = "C:\
Dim strTemp As String, lngRet As Lon
Dim lngVolSerial As Long, strVolName As String * cMaxPat
Dim lngMaxCompLen As Long, lngFileSysFlags As Lon
Dim strFileSysName As String * cMaxPat
lngRet = GetVolumeInformation(cDrive, strVolName, cMaxPath, lngTemp,
lngMaxCompLen, lngFileSysFlags, strFileSysName, cMaxPath
strTemp = Format(Hex(lngTemp), "00000000"
strTemp = Left(strTemp, 4) & "-" & Right(strTemp, 4
MsgBox strTem
End Su