Barryj
04-19-2011, 02:11 AM
I have found this code on the net and have been trying to alter it to have it close the work book if the computer name does not match that in the code.
I have not had much luck and was hoping some one may be able to lend a hand.
Private Sub Workbook_Open()
MsgBox Environ("ComputerName")
If Environ("ComputerName") <> UCase("Authorized PC Name") Then
MsgBox "Sorry No Go!" & vbCrLf & "Wrong computer!"
End
Else
'** Do your thing here
MsgBox "Proceed"
End If
End Sub
The idea is if somebody copies the workbook to another computer it will not open for them, it is for use on only one computer.
Thanks for any assistance
I have not had much luck and was hoping some one may be able to lend a hand.
Private Sub Workbook_Open()
MsgBox Environ("ComputerName")
If Environ("ComputerName") <> UCase("Authorized PC Name") Then
MsgBox "Sorry No Go!" & vbCrLf & "Wrong computer!"
End
Else
'** Do your thing here
MsgBox "Proceed"
End If
End Sub
The idea is if somebody copies the workbook to another computer it will not open for them, it is for use on only one computer.
Thanks for any assistance