Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Michel,
It certainly looks good to me. Maybe, just to allow for any type of input (C, C:, C:\, C:\myDir, etc.) Function DiskVolumeId(Drive As String) As String Dim sTemp As String Dim iPos As Long iPos = InStr(1, Drive, ":") Drive = IIf(iPos 0, Left(Drive, iPos), Drive & ":") sTemp = Hex(CreateObject("Scripting.FileSystemObject") _ .Drives.Item(CStr(Drive)).SerialNumber) DiskVolumeId = Left(sTemp, 4) & "-" & Right(sTemp, 4) End Function Regards Bob "Michel Pierron" wrote in message ... Hi Bob, If you agree, I prefer: Function DiskVolumeId(Drive As String) As String DiskVolumeId = Hex(CreateObject("Scripting.FileSystemObject") _ .Drives.Item(CStr(Drive)).SerialNumber) End Function MP "Bob Phillips" a écrit dans le message de news: ... A couple of ways (to get different answers :-)) 'Using FSO Function DiskVolumeId(Drive As String) As String Dim FSO As Object Set FSO = CreateObject("Scripting.FileSystemObject") DiskVolumeId = Format(CDbl(FSO.Drives(Drive).SerialNumber)) End Function snip -- HTH RP (remove nothere from the email address if mailing direct) "Paul Ramirez" wrote in message m... How can I obtain the serial number of a drive that a spreadsheet is installed on from within the same EXCEL spreadsheet? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Look up part of a number within a serial number and cpy back assoc | Excel Worksheet Functions | |||
Obtain row number of active cell | Excel Worksheet Functions | |||
Obtain drive letter assignment of CD/DVD drive? | Excel Discussion (Misc queries) | |||
Insert auto serial number in Excel template | Excel Programming |