Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Unique ID/Name for a computer?

All
1) Is there a way to identify a PC that excel is running on? I.e., IP address maybe?.
2) If there is, can I use VBA to somehow grab the id/name?
3) If so, what would the code look like
Thanks in Advance, -Warren
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default Unique ID/Name for a computer?

"Warren" wrote...
1) Is there a way to identify a PC that excel is running on? I.e., IP
address maybe?.
2) If there is, can I use VBA to somehow grab the id/name?
3) If so, what would the code look like?


What do you want to do with this? Identify a particular machine each time
your workbook is opened on it? Something else?

If IP numbers are dynamically assigned, then a particular IP number may be
assigned to PC A one day and PC X another day. Only if your users all have
static IP numbers (very unlikely for desktops in most Windows networks)
would IP number identify the same PC all the time.

One way to identify the same C: drive between sessions would be to use Shell
to run the command processor's DIR command redirected to a temporary file,
then read the disk serial number from that file using VBA's Open, Input and
Close statements.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Unique ID/Name for a computer?

The reason I want to do this is this: after the file has been 1) loaded onto the target PC harddrive AND 2) opened, if the file is then copied to someone else's PC, it will not be fully functional because I want the progam (VBA) to determine that it has already been opened. If it does determine that, it will render the spreadsheet less than fully functional

I know this is approach is not fool-proof but I also implemented the following rules to my procedures: when I send the file out, it has the users name at the top of the main sheet showing who the file belongs to with the idea that it will reduce the desire for someone to give a copy to another person before the person I send it to opens it

Another procedure rule I've implemented to tighten the security on this file is that each time the file is opened, it is opened using a set of randomly generated passwords from the previous time it was opened. Obviously the first time it is opened, it is opened without the need for passwords but once opened it is immedialy secured with brand new randomly created passwords - ain't pretty but seems to work. In summary, Here are the steps regarding my password methods..
OPENING THE FILE..
1) ...the first time without VBA using passwords (one-time). I send the file without password protection
2) VBA immediatly applies passwords by using radomly generated passwords from functions on a hidden sheet
3) VBA then password-protects the workbook and all the sheets using the new passwords
CLOSING THE FILE..
4) VBA resets the disable switch to ON
6) VBA resets the passwords again using the random generated procedure again (same as #2 above
7) VBA force saves the file
8) file is closed
-Warre

----- Harlan Grove wrote: ----

"Warren" wrote..
1) Is there a way to identify a PC that excel is running on? I.e., I
address maybe?
2) If there is, can I use VBA to somehow grab the id/name
3) If so, what would the code look like


What do you want to do with this? Identify a particular machine each tim
your workbook is opened on it? Something else

If IP numbers are dynamically assigned, then a particular IP number may b
assigned to PC A one day and PC X another day. Only if your users all hav
static IP numbers (very unlikely for desktops in most Windows networks
would IP number identify the same PC all the time

One way to identify the same C: drive between sessions would be to use Shel
to run the command processor's DIR command redirected to a temporary file
then read the disk serial number from that file using VBA's Open, Input an
Close statements



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default Unique ID/Name for a computer?

"Warren" wrote...
The reason I want to do this is this: after the file has been 1) loaded
onto the target PC harddrive AND 2) opened, if the file is then copied
to someone else's PC, it will not be fully functional because I want the
progam (VBA) to determine that it has already been opened. If it does
determine that, it will render the spreadsheet less than fully functional.

....

If you just want to discourage file copying, original distribution with
static password protection should be sufficient. That'll be enough to
prevent unsophisticated users from altering your file. As for sophisticated
users, take a look at all the responses in the Excel newsgroups about
available passwork crackers. It'd take maybe 2 seconds to remove all the
dynamically created random passwords you're thinking about adding. 2
seconds! After which time it'd be child's play to search & destroy all the
protective macro code you think is protecting your model.

Final comment: just speaking for myself, I don't think any software
distributed as Excel files is worth anything. Either you're providing a
service of some worth, and all files including .XLS ones are merely adjunct
to the service, or you're providing a product, in which case .XLS file
distribution isn't exactly the hallmark of professional development.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Unique ID/Name for a computer?

Lots of application protection schemes use a combination of hardware
identifiers (MAC address, Vol Serial etc...)

Here's some code to pull C: Volume Serial 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

Sub test()
Const cMaxPath = 256, cDrive = "C:\"

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)

MsgBox strTemp
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Warren" wrote in message
...
All,
1) Is there a way to identify a PC that excel is running on? I.e., IP

address maybe?.
2) If there is, can I use VBA to somehow grab the id/name?
3) If so, what would the code look like?
Thanks in Advance, -Warren





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Unique ID/Name for a computer?

How do I call another macro (with your code) from my AUTO_OPEN macro? (I am just learning VBA
Thanks again in advance
-Warre

----- Rob van Gelder wrote: ----

Lots of application protection schemes use a combination of hardwar
identifiers (MAC address, Vol Serial etc...

Here's some code to pull C: Volume Serial Numbe

Declare Function GetVolumeInformation Lib "kernel32" Alia
"GetVolumeInformationA" (ByVal lpRootPathName As String, ByVa
lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long
lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long
lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVa
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


--
Rob van Gelder - http://www.vangelder.co.nz/exce


"Warren" wrote in messag
..
All
1) Is there a way to identify a PC that excel is running on? I.e., I

address maybe?
2) If there is, can I use VBA to somehow grab the id/name
3) If so, what would the code look like
Thanks in Advance, -Warre




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Unique ID/Name for a computer?

Ummm...

You have some very elaborate plans for protecting your product, but if
you are just learning VBA what are you protecting? Wouldn't you be
better off learning VBA first and then worrying about how to protect
your work? Of course, you know your application better than I do,
so...

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
How do I call another macro (with your code) from my AUTO_OPEN macro? (I am just learning VBA)
Thanks again in advance,
-Warren

----- Rob van Gelder wrote: -----

Lots of application protection schemes use a combination of hardware
identifiers (MAC address, Vol Serial etc...)

Here's some code to pull C: Volume Serial 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

Sub test()
Const cMaxPath = 256, cDrive = "C:\"

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)

MsgBox strTemp
End Sub


--
Rob van Gelder -
http://www.vangelder.co.nz/excel


"Warren" wrote in message
...
All,
1) Is there a way to identify a PC that excel is running on? I.e., IP

address maybe?.
2) If there is, can I use VBA to somehow grab the id/name?
3) If so, what would the code look like?
Thanks in Advance, -Warren





  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Unique ID/Name for a computer?

Thanks for your reply Tushar

I am trying to learn VBA but in the very short-term I have this tool that is being used by quite a few insurance agents who have encouraged me to sell it. I think the market for this tool is rather small - not expecting to make a lot of $$ - more like a challenge

My question regarding Rob van Gelder's code is this: I'm not sure how 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 from AUTO_OPEN, but do I create a standard module or class modue. What is your suggestions for laying this out

Do you have any suggested VBA reading for beginners that is easy to read

Thank
-Warren

----- Tushar Mehta wrote: ----

Ummm..

You have some very elaborate plans for protecting your product, but if
you are just learning VBA what are you protecting? Wouldn't you be
better off learning VBA first and then worrying about how to protect
your work? Of course, you know your application better than I do,
so..

--
Regards

Tushar Meht
www.tushar-mehta.co
Excel, PowerPoint, and VBA add-ins, tutorial
Custom MS Office productivity solution

In article ,
says..
How do I call another macro (with your code) from my AUTO_OPEN macro? (I am just learning VBA
Thanks again in advance
-Warre
----- Rob van Gelder wrote: ----
Lots of application protection schemes use a combination of hardwar

identifiers (MAC address, Vol Serial etc...
Here's some code to pull C: Volume Serial Numbe
Declare Function GetVolumeInformation Lib "kernel32" Alia

"GetVolumeInformationA" (ByVal lpRootPathName As String, ByVa
lpVolumeNameBuffer As String, ByVal nVolumeNameSize As Long
lpVolumeSerialNumber As Long, lpMaximumComponentLength As Long
lpFileSystemFlags As Long, ByVal lpFileSystemNameBuffer As String, ByVa
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
--

Rob van Gelder -
http://www.vangelder.co.nz/exce
"Warren" wrote in messag

..
All
1) Is there a way to identify a PC that excel is running on? I.e., I

address maybe?
2) If there is, can I use VBA to somehow grab the id/name
3) If so, what would the code look like
Thanks in Advance, -Warre

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Unique ID/Name for a computer?

To answer your specific question, put Rob's code in a standard module.
To execute a subroutine named Test from some other code, use the
statement

Test

Books on VBA? I'd say a trip to the local library or book store is
called for. Browse through the selection and pick something that makes
sense to you.

Finally, XL is not designed for the development of secure solutions.
Any scheme you develop will be almost trivial to defeat. But, it's
your decision...

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
Thanks for your reply Tushar.

I am trying to learn VBA but in the very short-term I have this tool that is being used by quite a few insurance agents who have encouraged me to sell it. I think the market for this tool is rather small - not expecting to make a lot of $$ - more like a challenge.

My question regarding Rob van Gelder's code is this: I'm not sure how 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 from AUTO_OPEN, but do I create a standard module or class modue. What is your suggestions for laying this out?

Do you have any suggested VBA reading for beginners that is easy to read.

Thanks
-WarrenR

----- Tushar Mehta wrote: -----

Ummm...

You have some very elaborate plans for protecting your product, but if
you are just learning VBA what are you protecting? Wouldn't you be
better off learning VBA first and then worrying about how to protect
your work? Of course, you know your application better than I do,
so...

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
How do I call another macro (with your code) from my AUTO_OPEN macro? (I am just learning VBA)
Thanks again in advance,
-Warren
----- Rob van Gelder wrote: -----
Lots of application protection schemes use a combination of hardware

identifiers (MAC address, Vol Serial etc...)
Here's some code to pull C: Volume Serial 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
Sub test()

Const cMaxPath = 256, cDrive = "C:\"
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)
MsgBox strTemp

End Sub
--

Rob van Gelder -
http://www.vangelder.co.nz/excel
"Warren" wrote in message

...
All,
1) Is there a way to identify a PC that excel is running on? I.e., IP

address maybe?.
2) If there is, can I use VBA to somehow grab the id/name?
3) If so, what would the code look like?
Thanks in Advance, -Warren


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
Row Height variations from computer to computer on same workbook Barb Reinhardt Excel Discussion (Misc queries) 1 April 20th 10 07:06 PM
Formulaed cell response varies from computer to computer WKH Excel Discussion (Misc queries) 3 November 21st 07 06:37 PM
Display size difference- PC computer vs. Mac computer? dk_ Excel Discussion (Misc queries) 1 October 17th 06 05:48 AM
How do I copy all Excel files from old computer to new computer? Rfarsh Excel Discussion (Misc queries) 2 December 20th 05 03:23 AM
Autocomplete works with my home computer but not the office computer Andy Excel Discussion (Misc queries) 4 December 11th 04 07:21 PM


All times are GMT +1. The time now is 02:43 AM.

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

About Us

"It's about Microsoft Excel"