View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
omer omer is offline
external usenet poster
 
Posts: 74
Default Reading desktop/Notebook serial number or system ID

Nothing, I just wanted to give you the whole picture :)
Thank you RBS.

OMER

"RB Smissaert" wrote:

Any other ideas?


What is wrong with the current setup then?

RBS


"OMER" wrote in message
...
The whole picture is that I want to tie the ID to the workbook, so that it
only runs in the registered machine. Any other ideas?

OMER

"RB Smissaert" wrote:

I assume that since these are functions I can used them as regular
user-defined functions and assigned them to a specific cell. Is that
correct?

Yes, that should work, but not sure why you would want that.

RBS


"OMER" wrote in message
...
Thank you very much RBS,
I'll try this.

I assume that since these are functions I can used them as regular
user-defined functions and assigned them to a specific cell. Is that
correct?

Regards,
OMER

"RB Smissaert" wrote:

You could try the GetVolumeInformation API:

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

Function getDriveVolumeSerial(Optional strDriveLetter As String) As
String

'will get the drive serial number
'default is the drive that the application is on
'otherwise can do for example: getDriveSerialNumber("D")
'-------------------------------------------------------

Dim strDrivePath As String
Dim Serial As Long
Dim VName As String
Dim FSName As String

If Len(strDriveLetter) = 0 Then
strDrivePath = Left$(Application.Path, 1) & ":\"
Else
strDrivePath = strDriveLetter & ":\"
End If

'Create buffers
VName = String$(255, Chr$(0))
FSName = String$(255, Chr$(0))

'Get the volume information
GetVolumeInformation strDrivePath, VName, 255, Serial, 0, 0, FSName,
255

getDriveVolumeSerial = Trim(Str$(Abs(Serial)))

End Function


Run it from the ThisWorkbook module in the Private Sub Workbook_Open()



RBS


"OMER" wrote in message
...
Hola,
I need to know how to read serial number, system ID or Windows ID
from
an
Excel macro.
I want to use this to limit a workbook to run only on the
desktop/notebook
that is licensed to.

Any help on achieving this or an alternative method is highly
appreciated.
Regards,