ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Found a small problem........ (https://www.excelbanter.com/excel-programming/361159-found-small-problem.html)

Duncan[_5_]

Found a small problem........
 
Hi Guys

I'm at a loss as to why this isnt working...

If Application.UserName = (my username here) Then
Unload Userform1
Else
MsgBox Application.UserName
End If


I put the msgbox bit in just in case there was a problem with my
username....it looks exactly the same as typed, i dont geddit...

any ideas anyone?

Duncan


Bob Phillips[_14_]

Found a small problem........
 
Try this

If Trim(Application.UserName) = "Bob" Then
Unload UserForm1
Else
MsgBox Application.UserName
End If


--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)

"Duncan" wrote in message
ups.com...
Hi Guys

I'm at a loss as to why this isnt working...

If Application.UserName = (my username here) Then
Unload Userform1
Else
MsgBox Application.UserName
End If


I put the msgbox bit in just in case there was a problem with my
username....it looks exactly the same as typed, i dont geddit...

any ideas anyone?

Duncan




NickHK

Found a small problem........
 
Duncan,
AFAIK, this returns the name entered when Excel/Office was first installed
i.e. the name that appears in the HelpAbout.. box, not necessarily your
windows username.

NickHK

"Duncan" wrote in message
ups.com...
Hi Guys

I'm at a loss as to why this isnt working...

If Application.UserName = (my username here) Then
Unload Userform1
Else
MsgBox Application.UserName
End If


I put the msgbox bit in just in case there was a problem with my
username....it looks exactly the same as typed, i dont geddit...

any ideas anyone?

Duncan




Duncan[_5_]

Found a small problem........
 
Bob:- Many thanks the trim did make it work

Nick: - I think you are right but in this instance our users have a
generic install pattern which grabs their username from novell login,
(i dont really understand how or why but the end result is the
usernames end up the same so that is all good!)

Many thanks both,

Duncan



All times are GMT +1. The time now is 11:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com