How to restrict the use of a workbook to one computer?

I

Ivar

Hi,

I need to restrict the use of a workbook to one computer.
Is there some way to do this?

Thanks in anticipation.

Ivar
 
B

Bernie Deitrick

Ivar,

Not reliably from within Excel. If I want to use your file on another
computer, I will be able to figure a way around whatever you do, unless you
do something within a compiled DLL or XLL module.

HTH,
Bernie
MS Excel MVP
 
J

jeff

Hi,

Bernie is correct. However, if you can live with some
insecurity, you can always put a key in the registry
of the sole machine and in the Auto_Open macro, check
for the key - if not there, immediately close out.
Anyone can mess with the registry settings, so this is
not foolproof.

the code to set, retrieve, and delete values:

Sub SetReg()
' Place some settings in the registry.
SaveSetting appname:="TestApp", section:="Startup", _
key:="Top", setting:=75
SaveSetting "TestApp", "Startup", "Left", 50
End Sub
Sub getSettings()
Dim MySettings As Variant, intSettings As Integer
MySettings = GetAllSettings(appname:="TestApp",
section:="Startup")
For intSettings = LBound(MySettings, 1) To UBound
(MySettings, 1)
Debug.Print MySettings(intSettings, 0), MySettings
(intSettings, 1)
Next intSettings
End Sub
Sub deletesettings()
' Remove section and all its settings from registry.
DeleteSetting "TestApp", "Startup"
End Sub

The values 50 and 75 are set in [HKEY_USERS]-Software-
VB and VBA Program Settings

good luck,
jeff
 
Top