View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Sam Wilson Sam Wilson is offline
external usenet poster
 
Posts: 523
Default worksheet that will only work on one users pc

Apologies, that should say:

if not environ(5) = "COMPUTERNAME=MyComputerName" then ...

"Sam Wilson" wrote:

This works, but is far from bullet proof.

In the workbook press Alt + F11. Find your workbook in the project window,
click on the little plus, right click "workbook" and "view code"

In the main window at the top, change the left hand drop down box to say
"Workbook" and the righthand one to say "Open"

This will appear in the main window:
Private Sub Workbook_Open()

End Sub

in the gap between Private... and End Sub paste the following:
if not environ(5) = "MyComputerName" then activeworkbook.Close

**Change "MyComputerName" to the name of the computer where this workbook is
allowed to be used!**

It's far from bullet proof, because if macros are disabled the code won't run.



"Fan924" wrote:

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?