Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Please help with "Username"
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 Auto_Open() 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
"filename is locked for editing by username" | Excel Discussion (Misc queries) | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
Save active sheet as "filename" on a remote server with username and password | Excel Programming | |||
Environ("username") | Excel Programming | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel |