Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Environmental Variables


Is there a envstring for the Environ() function that will return a unique
value, such as a serial # of the processor, Windows, Office, etc?

I want to setup some type of security should the XLS and not the XLT be
copied for use on another computer. I have no problem with the copying, it's
just that there will be CC info stored in the existing XLS file and I don't
want that to be distributed.
If I can check for two or three unique serials, I can have the routine clear
the existing data and reset the XLS to it's original delivered status. By
having more than one serial # to check, I can make sure the reset won't
happen should a minor hardware swap take place.

Sometime ago, I worked on a project in FoxPro where the code used a primary
harddrive serial # as a seed for an activation code. Was look for a similar
avenue if it's not too complicated.
Thx, JG
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Environmental Variables

ENVIRON() gives you the UserName , ComputerName. Will help ??

Msgbox Environ("UserName")
Msgbox Environ("ComputerName")


If this post helps click Yes
---------------
Jacob Skaria


"John G." wrote:

Is there a envstring for the Environ() function that will return a unique
value, such as a serial # of the processor, Windows, Office, etc?

I want to setup some type of security should the XLS and not the XLT be
copied for use on another computer. I have no problem with the copying, it's
just that there will be CC info stored in the existing XLS file and I don't
want that to be distributed.
If I can check for two or three unique serials, I can have the routine clear
the existing data and reset the XLS to it's original delivered status. By
having more than one serial # to check, I can make sure the reset won't
happen should a minor hardware swap take place.

Sometime ago, I worked on a project in FoxPro where the code used a primary
harddrive serial # as a seed for an activation code. Was look for a similar
avenue if it's not too complicated.
Thx, JG

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Environmental Variables


Jacob, thx for the reply.

I have run through the whole list of envstring, those two in particular, and
don't see any problem using those just was wondering if there's a function
that might get me a little deeper, ie, serial #'s.

JG

"Jacob Skaria" wrote:

ENVIRON() gives you the UserName , ComputerName. Will help ??

Msgbox Environ("UserName")
Msgbox Environ("ComputerName")


If this post helps click Yes
---------------
Jacob Skaria


"John G." wrote:

Is there a envstring for the Environ() function that will return a unique
value, such as a serial # of the processor, Windows, Office, etc?

I want to setup some type of security should the XLS and not the XLT be
copied for use on another computer. I have no problem with the copying, it's
just that there will be CC info stored in the existing XLS file and I don't
want that to be distributed.
If I can check for two or three unique serials, I can have the routine clear
the existing data and reset the XLS to it's original delivered status. By
having more than one serial # to check, I can make sure the reset won't
happen should a minor hardware swap take place.

Sometime ago, I worked on a project in FoxPro where the code used a primary
harddrive serial # as a seed for an activation code. Was look for a similar
avenue if it's not too complicated.
Thx, JG

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Environmental Variables


I found this code but it only seems to produce the disk partitiion ID's and
not motherboard, processor, and bios.

It it even possible?

Private Sub GetSerials()
Dim List, Msg, Object
On Local Error Resume Next

Set List =
GetObject("winmgmts:{impersonationLevel=impersonat e}").InstancesOf("Win32_BaseBoard")
For Each Object In List
Msg = Msg & "Motherboard Serial Number: " & Object.SerialNumber & vbCrLf
Next

Set List =
GetObject("winmgmts:{impersonationLevel=impersonat e}").InstancesOf("Win32_Processor")
For Each Object In List
Msg = Msg & "Processor Unique ID: " & Object.UniqueID & vbCrLf
Next

Set List =
GetObject("winmgmts:{impersonationLevel=impersonat e}").InstancesOf("Win32_BIOS")
For Each Object In List
Msg = Msg & "BIOS Serial Number: " & Object.SerialNumber & vbCrLf
Next

Set List =
GetObject("winmgmts:{impersonationLevel=impersonat e}").InstancesOf("Win32_LogicalDisk")
For Each Object In List
Msg = Msg & "Disk Serial Number: " & Object.VolumeSerialNumber & vbCrLf
Next

MsgBox Msg

End Sub


"John G." wrote:

Is there a envstring for the Environ() function that will return a unique
value, such as a serial # of the processor, Windows, Office, etc?

I want to setup some type of security should the XLS and not the XLT be
copied for use on another computer. I have no problem with the copying, it's
just that there will be CC info stored in the existing XLS file and I don't
want that to be distributed.
If I can check for two or three unique serials, I can have the routine clear
the existing data and reset the XLS to it's original delivered status. By
having more than one serial # to check, I can make sure the reset won't
happen should a minor hardware swap take place.

Sometime ago, I worked on a project in FoxPro where the code used a primary
harddrive serial # as a seed for an activation code. Was look for a similar
avenue if it's not too complicated.
Thx, JG

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Environmental Variables

To get serial number of mother board; try the below function..

Public Function MBSerialNumber() As String
Dim objs As Object, obj As Object, objWM As Object
Set objWM = GetObject("WinMgmts:")
Set objs = objWM.InstancesOf("Win32_BaseBoard")
For Each obj In objs
MBSerialNumber = "," & MBSerialNumber & obj.SerialNumber
Next
MBSerialNumber = Mid(MBSerialNumber, 2)
End Function

If this post helps click Yes
---------------
Jacob Skaria


"John G." wrote:

I found this code but it only seems to produce the disk partitiion ID's and
not motherboard, processor, and bios.

It it even possible?

Private Sub GetSerials()
Dim List, Msg, Object
On Local Error Resume Next

Set List =
GetObject("winmgmts:{impersonationLevel=impersonat e}").InstancesOf("Win32_BaseBoard")
For Each Object In List
Msg = Msg & "Motherboard Serial Number: " & Object.SerialNumber & vbCrLf
Next

Set List =
GetObject("winmgmts:{impersonationLevel=impersonat e}").InstancesOf("Win32_Processor")
For Each Object In List
Msg = Msg & "Processor Unique ID: " & Object.UniqueID & vbCrLf
Next

Set List =
GetObject("winmgmts:{impersonationLevel=impersonat e}").InstancesOf("Win32_BIOS")
For Each Object In List
Msg = Msg & "BIOS Serial Number: " & Object.SerialNumber & vbCrLf
Next

Set List =
GetObject("winmgmts:{impersonationLevel=impersonat e}").InstancesOf("Win32_LogicalDisk")
For Each Object In List
Msg = Msg & "Disk Serial Number: " & Object.VolumeSerialNumber & vbCrLf
Next

MsgBox Msg

End Sub


"John G." wrote:

Is there a envstring for the Environ() function that will return a unique
value, such as a serial # of the processor, Windows, Office, etc?

I want to setup some type of security should the XLS and not the XLT be
copied for use on another computer. I have no problem with the copying, it's
just that there will be CC info stored in the existing XLS file and I don't
want that to be distributed.
If I can check for two or three unique serials, I can have the routine clear
the existing data and reset the XLS to it's original delivered status. By
having more than one serial # to check, I can make sure the reset won't
happen should a minor hardware swap take place.

Sometime ago, I worked on a project in FoxPro where the code used a primary
harddrive serial # as a seed for an activation code. Was look for a similar
avenue if it's not too complicated.
Thx, JG



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Environmental Variables


Thx again for the reply...I'm not getting anything back MB#. Stepped
thru the function and the For...Next isn't grabbing anything. May be for the
same reason the code I found didn't find it either. JG

"Jacob Skaria" wrote:

To get serial number of mother board; try the below function..

Public Function MBSerialNumber() As String
Dim objs As Object, obj As Object, objWM As Object
Set objWM = GetObject("WinMgmts:")
Set objs = objWM.InstancesOf("Win32_BaseBoard")
For Each obj In objs
MBSerialNumber = "," & MBSerialNumber & obj.SerialNumber
Next
MBSerialNumber = Mid(MBSerialNumber, 2)
End Function

If this post helps click Yes
---------------
Jacob Skaria


"John G." wrote:

I found this code but it only seems to produce the disk partitiion ID's and
not motherboard, processor, and bios.

It it even possible?

Private Sub GetSerials()
Dim List, Msg, Object
On Local Error Resume Next

Set List =
GetObject("winmgmts:{impersonationLevel=impersonat e}").InstancesOf("Win32_BaseBoard")
For Each Object In List
Msg = Msg & "Motherboard Serial Number: " & Object.SerialNumber & vbCrLf
Next

Set List =
GetObject("winmgmts:{impersonationLevel=impersonat e}").InstancesOf("Win32_Processor")
For Each Object In List
Msg = Msg & "Processor Unique ID: " & Object.UniqueID & vbCrLf
Next

Set List =
GetObject("winmgmts:{impersonationLevel=impersonat e}").InstancesOf("Win32_BIOS")
For Each Object In List
Msg = Msg & "BIOS Serial Number: " & Object.SerialNumber & vbCrLf
Next

Set List =
GetObject("winmgmts:{impersonationLevel=impersonat e}").InstancesOf("Win32_LogicalDisk")
For Each Object In List
Msg = Msg & "Disk Serial Number: " & Object.VolumeSerialNumber & vbCrLf
Next

MsgBox Msg

End Sub


"John G." wrote:

Is there a envstring for the Environ() function that will return a unique
value, such as a serial # of the processor, Windows, Office, etc?

I want to setup some type of security should the XLS and not the XLT be
copied for use on another computer. I have no problem with the copying, it's
just that there will be CC info stored in the existing XLS file and I don't
want that to be distributed.
If I can check for two or three unique serials, I can have the routine clear
the existing data and reset the XLS to it's original delivered status. By
having more than one serial # to check, I can make sure the reset won't
happen should a minor hardware swap take place.

Sometime ago, I worked on a project in FoxPro where the code used a primary
harddrive serial # as a seed for an activation code. Was look for a similar
avenue if it's not too complicated.
Thx, JG

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Not at all clear on use of variables and/or object variables JMay-Rke Excel Discussion (Misc queries) 11 July 4th 08 06:36 PM
Storing variables in a macro and using those variables to performcalculations. [email protected] Excel Programming 3 December 10th 07 04:13 PM
variables april27 Excel Programming 1 June 16th 06 01:15 PM
Too many variables? elite Excel Worksheet Functions 2 May 19th 06 10:26 PM
Using variables in RCs Mike D. Excel Programming 2 March 1st 05 10:53 PM


All times are GMT +1. The time now is 02:53 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"