LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
"filename is locked for editing by username" srinath Excel Discussion (Misc queries) 1 February 26th 09 11:35 AM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Save active sheet as "filename" on a remote server with username and password Teddy[_3_] Excel Programming 2 May 11th 07 04:48 PM
Environ("username") riso Excel Programming 11 March 9th 07 10:43 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM


All times are GMT +1. The time now is 02:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"