J
Jen
Hi There,
I want to test whether the person who wants to open a file is entitled to it
or not ...
I am testing it with the Username in Excel versus an array with Usernames.
The problem is that my code says always that it is a "good user"... even if
the username under Tools>Options>General is "dfhdgkj"!
Any insight on where I am missing the ball?
Somewhere on the NG I found the code from Norman Jones, so 99% of the credit
goes to him ... the 1% I changed made it work not properly though
Private Sub Workbook_Open()
Dim s As Integer
Dim vh As Integer
Arr = VBA.Array("Guest", "Jim", "Bob", "Norman")
Res = Application.Match(Environ("UserName"), Arr, 0)
If IsError(Res) Then
MsgBox "GOOD user"
Else
MsgBox "BAD user"
End If
End Sub
Thanks for your help!
Jen
I want to test whether the person who wants to open a file is entitled to it
or not ...
I am testing it with the Username in Excel versus an array with Usernames.
The problem is that my code says always that it is a "good user"... even if
the username under Tools>Options>General is "dfhdgkj"!
Any insight on where I am missing the ball?
Somewhere on the NG I found the code from Norman Jones, so 99% of the credit
goes to him ... the 1% I changed made it work not properly though
Private Sub Workbook_Open()
Dim s As Integer
Dim vh As Integer
Arr = VBA.Array("Guest", "Jim", "Bob", "Norman")
Res = Application.Match(Environ("UserName"), Arr, 0)
If IsError(Res) Then
MsgBox "GOOD user"
Else
MsgBox "BAD user"
End If
End Sub
Thanks for your help!
Jen