P
Please Help
Hello all,
I use the code below to validate the users who open the file. Somehow, the
code is not recognizing two of the usernames. It keeps taking them to the
Case Else, even though they are correct usernames. I even checked with my IT
department to make sure that they are correct usernames. There are 19
authorized users.
Does anyone know why? Thanks.
Private Sub Autpen()
Dim UName As String 'Use to check for authorized user
UName = LCase(Environ("UserName"))
Select Case UName
Case "user1", "user2", "user3", "user4", "user5",.....,"user19"
Case Else
Workbooks("Workbook.xls").Windows(1).Visible = False
MsgBox "Sorry, you are not one of the authorized users for " & _
"this file." vbCritical, "User Validator Macro"
Workbooks("Workbook.xls").Close False
End Select
Worksheets("Sheet1").Activate
End Sub
I use the code below to validate the users who open the file. Somehow, the
code is not recognizing two of the usernames. It keeps taking them to the
Case Else, even though they are correct usernames. I even checked with my IT
department to make sure that they are correct usernames. There are 19
authorized users.
Does anyone know why? Thanks.
Private Sub Autpen()
Dim UName As String 'Use to check for authorized user
UName = LCase(Environ("UserName"))
Select Case UName
Case "user1", "user2", "user3", "user4", "user5",.....,"user19"
Case Else
Workbooks("Workbook.xls").Windows(1).Visible = False
MsgBox "Sorry, you are not one of the authorized users for " & _
"this file." vbCritical, "User Validator Macro"
Workbooks("Workbook.xls").Close False
End Select
Worksheets("Sheet1").Activate
End Sub