worksheet that will only work on one users pc

F

Fan924

I am trying to create a excel worksheet that will only work on one
users pc. Oh no, not that again! I have read much of the archives
here..

I am not looking for something bullet proof. I just want to make it
difficult for the average user to pass around worksheet copies. If I
can key a macro to detect something that is unique in every users pc.
Ideas?
 
P

Per Jessen

Hi

You could use this:

Private Sub Workbook_Open()
' use ?Environ("Computername") in Immediate window to to get computer name
If Environ("Computername") <> "MyComputerName" Then ActiveWorkbook.Close
SaveChanges:=False
End Sub

Regards,
Per
 
A

AltaEgo

1) This is very easily worked around by disabling macros when the WB is
opened. You could make it a little more robust by hiding sheets
(xlveryhidden) on exit and unhiding them when the WB is opened and macros
are enabled. You would just leave one sheet visible advising macros are
required and usage of the WB is restricted to particular user/s.

2) You could use Environ("USERNAME") in place of Environ("Computername") as
used by Per to limit it to a particular user rather than a particular PC.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top