Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello, ..Hope you all enjoyed the jollies
Does anybody know a routine to get an unique ID from each computer. would like to use it for preventative copying. Thanks for looking CA -- Message posted from http://www.ExcelForum.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here is one way, get the C drive volume number
Function DiskVolumeId() As String Dim FSO As Object Set FSO = CreateObject("Scripting.FileSystemObject") DiskVolumeId = Format(CDbl(FSO.Drives("C:").SerialNumber)) End Function -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "CAA " wrote in message ... Hello, ..Hope you all enjoyed the jollies Does anybody know a routine to get an unique ID from each computer. I would like to use it for preventative copying. Thanks for looking CAA --- Message posted from http://www.ExcelForum.com/ |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Bob
this is not fair I had the same idea but my code is much longer :-) -- Regards Frank Kabel Frankfurt, Germany Bob Phillips wrote: Here is one way, get the C drive volume number Function DiskVolumeId() As String Dim FSO As Object Set FSO = CreateObject("Scripting.FileSystemObject") DiskVolumeId = Format(CDbl(FSO.Drives("C:").SerialNumber)) End Function "CAA " wrote in message ... Hello, ..Hope you all enjoyed the jollies Does anybody know a routine to get an unique ID from each computer. I would like to use it for preventative copying. Thanks for looking CAA --- Message posted from http://www.ExcelForum.com/ |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
As I keep telling my kids, life ain't fair!
I once wrote a complex class for reading and writing to the registry, and then WSH came out with a RegRead and RegWrite method. Half a dozen lines. So don't talk to me about fair<G Bob "Frank Kabel" wrote in message ... Hi Bob this is not fair I had the same idea but my code is much longer :-) -- Regards Frank Kabel Frankfurt, Germany Bob Phillips wrote: Here is one way, get the C drive volume number Function DiskVolumeId() As String Dim FSO As Object Set FSO = CreateObject("Scripting.FileSystemObject") DiskVolumeId = Format(CDbl(FSO.Drives("C:").SerialNumber)) End Function "CAA " wrote in message ... Hello, ..Hope you all enjoyed the jollies Does anybody know a routine to get an unique ID from each computer. I would like to use it for preventative copying. Thanks for looking CAA --- Message posted from http://www.ExcelForum.com/ |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Excellent stuff Bob.
I'm amazed how simple you made that, i was expecting something mor along the lines of Franks and the headache that follwed trying t understand it, but now, ..wow. Very impressed. Thankyou once again Bob for another on the ball answer. Frank, what can i say, the guy on the motorbike will usually win th marathon. CA -- Message posted from http://www.ExcelForum.com |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The thing about Frank's is that you don't need to understand it if you want
a solution. When we provide API solutions they are never obvious, APIs aren't, but if they work, what the heck, use them. -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "CAA " wrote in message ... Excellent stuff Bob. I'm amazed how simple you made that, i was expecting something more along the lines of Franks and the headache that follwed trying to understand it, but now, ..wow. Very impressed. Thankyou once again Bob for another on the ball answer. Frank, what can i say, the guy on the motorbike will usually win the marathon. CAA --- Message posted from http://www.ExcelForum.com/ |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Excellent stuff Bob.
I'm amazed how simple you made that, i was expecting something more along the lines of Franks and the headache that follwed trying to understand it, but now, ..wow. Very impressed. Thankyou once again Bob for another on the ball answer. Frank, what can i say, the guy on the motorbike will usually win the marathon. lol hat's really a got methapher Regards Frank |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If it makes you feel any better, Frank, Bob's nasty code doesn't work
here. :-) We disable WSH at ever reboot. Getting it to die is another matter though. Frank Kabel wrote: Hi Bob this is not fair I had the same idea but my code is much longer :-) -- Regards Frank Kabel Frankfurt, Germany Bob Phillips wrote: Here is one way, get the C drive volume number Function DiskVolumeId() As String Dim FSO As Object Set FSO = CreateObject("Scripting.FileSystemObject") DiskVolumeId = Format(CDbl(FSO.Drives("C:").SerialNumber)) End Function "CAA " wrote in message ... Hello, ..Hope you all enjoyed the jollies Does anybody know a routine to get an unique ID from each computer. I would like to use it for preventative copying. Thanks for looking CAA --- Message posted from http://www.ExcelForum.com/ |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi Steve you made my day <vbg Steve Garman wrote: If it makes you feel any better, Frank, Bob's nasty code doesn't work here. :-) We disable WSH at ever reboot. Getting it to die is another matter though. Frank Kabel wrote: Hi Bob this is not fair I had the same idea but my code is much longer :-) -- Regards Frank Kabel Frankfurt, Germany Bob Phillips wrote: Here is one way, get the C drive volume number Function DiskVolumeId() As String Dim FSO As Object Set FSO = CreateObject("Scripting.FileSystemObject") DiskVolumeId = Format(CDbl(FSO.Drives("C:").SerialNumber)) End Function "CAA " wrote in message ... Hello, ..Hope you all enjoyed the jollies Does anybody know a routine to get an unique ID from each computer. I would like to use it for preventative copying. Thanks for looking CAA --- Message posted from http://www.ExcelForum.com/ |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
you may use the HD drive ID for this. The following code gets this number: 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 Function get_drive_serial() Const cMaxPath = 256, cDrive = "C:\" Dim lngtemp Dim strTemp As String, lngRet As Long Dim lngVolSerial As Long, strVolName As String * cMaxPath Dim lngMaxCompLen As Long, lngFileSysFlags As Long Dim strFileSysName As String * cMaxPath lngRet = GetVolumeInformation(cDrive, strVolName, cMaxPath, _ lngTemp, lngMaxCompLen, lngFileSysFlags, strFileSysName, _ cMaxPath) strTemp = Format(Hex(lngTemp), "00000000") strTemp = Left(strTemp, 4) & "-" & Right(strTemp, 4) get_drive_serial = strTemp End Sub -- Regards Frank Kabel Frankfurt, Germany Hello, ..Hope you all enjoyed the jollies Does anybody know a routine to get an unique ID from each computer. I would like to use it for preventative copying. Thanks for looking CAA --- Message posted from http://www.ExcelForum.com/ |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
this thread is just what I was looking for -- much thanks to all ! Having said that, I am going to show my ignorance. I program in Visual Studio .NET VB for a while now & have not come accross a part of your example : strVolName As String * cMaxPath VB gives me an error on the "* cMaxPath" expects end ot statment. Not sure what this syntax means - Thanks Again ----- Frank Kabel wrote: ----- Hi you may use the HD drive ID for this. The following code gets this number: 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 Function get_drive_serial() Const cMaxPath = 256, cDrive = "C:\" Dim lngtemp Dim strTemp As String, lngRet As Long Dim lngVolSerial As Long, strVolName As String * cMaxPath Dim lngMaxCompLen As Long, lngFileSysFlags As Long Dim strFileSysName As String * cMaxPath lngRet = GetVolumeInformation(cDrive, strVolName, cMaxPath, _ lngTemp, lngMaxCompLen, lngFileSysFlags, strFileSysName, _ cMaxPath) strTemp = Format(Hex(lngTemp), "00000000") strTemp = Left(strTemp, 4) & "-" & Right(strTemp, 4) get_drive_serial = strTemp End Sub -- Regards Frank Kabel Frankfurt, Germany Hello, ..Hope you all enjoyed the jollies Does anybody know a routine to get an unique ID from each computer. I would like to use it for preventative copying. Thanks for looking CAA --- Message posted from http://www.ExcelForum.com/ |
#12
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim strVolName As String * cMaxPath
in classic VB defines a fixed length string. This has probably gone missing in .Net The alternative is to dim the variable as string then make sure it's long enough before using it. Dim strVolName As String Dim strFileSysName As String strVolName = String$(255, Chr$(0)) strFileSysName = String$(255, Chr$(0)) also works in classic VB. If the String$ function has also gone missing in .Net you may need to try something else similar Gehres wrote: Hi, this thread is just what I was looking for -- much thanks to all ! Having said that, I am going to show my ignorance. I program in Visual Studio .NET VB for a while now & have not come accross a part of your example : strVolName As String * cMaxPath VB gives me an error on the "* cMaxPath" expects end ot statment. Not sure what this syntax means - Thanks Again ----- Frank Kabel wrote: ----- Hi you may use the HD drive ID for this. The following code gets this number: 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 Function get_drive_serial() Const cMaxPath = 256, cDrive = "C:\" Dim lngtemp Dim strTemp As String, lngRet As Long Dim lngVolSerial As Long, strVolName As String * cMaxPath Dim lngMaxCompLen As Long, lngFileSysFlags As Long Dim strFileSysName As String * cMaxPath lngRet = GetVolumeInformation(cDrive, strVolName, cMaxPath, _ lngTemp, lngMaxCompLen, lngFileSysFlags, strFileSysName, _ cMaxPath) strTemp = Format(Hex(lngTemp), "00000000") strTemp = Left(strTemp, 4) & "-" & Right(strTemp, 4) get_drive_serial = strTemp End Sub -- Regards Frank Kabel Frankfurt, Germany Hello, ..Hope you all enjoyed the jollies Does anybody know a routine to get an unique ID from each computer. I would like to use it for preventative copying. Thanks for looking CAA --- Message posted from http://www.ExcelForum.com/ |
#13
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Steve Garman wrote:
Dim strVolName As String * cMaxPath in classic VB defines a fixed length string. This has probably gone missing in .Net The alternative is to dim the variable as string then make sure it's long enough before using it. Dim strVolName As String Dim strFileSysName As String strVolName = String$(255, Chr$(0)) strFileSysName = String$(255, Chr$(0)) also works in classic VB. Sorry, that should have more properly been: strVolName = String$(cMaxPath, Chr$(0)) strFileSysName = String$(cMaxPath, Chr$(0)) |
#14
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Steve - Thanks much - in now makes sense.
It's always amazes me how we can spend so much time on such small issues Thanks again |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel Data Protection Best Practice: AKA: Real Sheet Protection | Excel Discussion (Misc queries) | |||
Excel Data Protection- AKA: Sheet/Macro Password Protection | Setting up and Configuration of Excel | |||
Filer for unique records and return all column data for unique rec | Excel Discussion (Misc queries) | |||
How to pick out unique components in a list with unique and common | Excel Discussion (Misc queries) | |||
Attempting to sort unique/only count first record in each unique g | Excel Discussion (Misc queries) |