MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Locking an excel file to be use in certain computers


Posted by Hugo Ortiz on February 15, 2002 9:00 PM

How can I block an excel file, I mean I just want to be use in certain computers; that if anybody copies the file to another computer it won't work.

Hugo


Posted by Steve on February 17, 2002 10:43 PM

Use the GetSetting SaveSetting commands to make a Registry Entry. As long as they cannot determine the location of the entry in the Registry, or look at your code, you should be OK.

The conventional wisdom is to make the Registry key the name of the program, but that might be too easy.

Posted by Knut Johnsen on March 21, 2002 1:07 AM

Use the Windows API functions GetUserName and GetComputerName in a Visual Basic subroutine which runs as the workbook opens. If it is the wrong computer (or user) just give a message and close the workbook.
(You must disable the CTRL-Break or ESC key so the user cannot break the macro as the message is displayed.)

Have not tried this, but I am using the two mentioned API calls to create a log in a file as it is saved!

With Regards, Knut.