Hi Excel Gurus
I am looking to restrict workbook to access to specific computers, because I am getting a lot of data mismatch due that users are moving files from pc to pc by email.
the user are low users
Under some research on site http://www.ozgrid.com/forum/showthread.php?t=159712
I am trying to make the codes below work but no success
Can any Gurus assist me
thank you
Code
Function CompName() As String
CompName = Environ("COMPUTERNAME")
End Function
Private Sub Workbook_Open()
Dim sComp As String
On Error Resume Next 'in case name doesn't exist
'check value stored for computer
sComp = Evaluate(ThisWorkbook.Names("Comp").RefersTo)
'range name doesn't exist so create it & set value
If sComp = "" Then sComp = CompName '
ThisWorkbook.Names.Add Name:="Comp", RefersTo:=sComp
If CompName <> sComp Then
MsgBox "Not registered to this computer"
ThisWorkbook.Close
End If
End Sub
Display More
and