View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Please help Please help is offline
external usenet poster
 
Posts: 75
Default Please help with "Username"

EagleOne,

Thanks for your response. I am not sure what this test will accomplish on
my situation. Please explain.

Thanks.

" wrote:

Please Help

Copy/Paste the information sources to two different comumns on a w/s let us say Column A and F

Then place this formula in column C "=A1=F1" (Copy Down) then check all of the "False"

Trick I learned a long time ago is to =Trim(Clean("YoutText"))

EagleOne


Please Help wrote:

Good morning Dave,

Unfortunately, the users are located in another state. I double-checked the
usernames in my code and in our addressbook. They are the same.

As far as case sensitivity, one of the lines in my code converts the
usernames to lower case. By having that line, do you think case is still an
issue?

Thanks.

"Dave Peterson" wrote:

Just to add to Tim's response...

Can you go to the offenders and have them run a small macro:

Option Explicit
sub testit()
debug.print "****" & environ("username") & "****"
end sub

(the ****'s are just to help the username stand out more)

Then look at the immediate window in the VBE and see if you notice the spelling
error.

I'm gonna bet that you still have a typing difference.

===========

Or your code has an uppercase letter that you're missing. You can avoid that
by:

Select case lcase(...)
case is = lcase("test1"), lcase("test2"), ....

or add a line to the top of the module that will make all text comparisons
non-case sensitive:

Option Compare Text



Please Help wrote:

Hi Dave,

Thanks for your response. Yes, everything is in lower case. In addition,
there were no extra space or characters and transposed of characters.

That is what puzzles me. Is there a limit on how many username can be used
for "Username"?

Thanks.

"Dave Peterson" wrote:

Are you typing the usernames in lowercase?

Are you sure that there aren't extra space characters in the name string?

I'd bet that there was a difference--maybe a couple of transposed characters???

Please Help wrote:

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

--

Dave Peterson


--

Dave Peterson