What do you mean "does not work"? Are you sure the UserName is
actually 'Mike'. Note that Environ("UserName") returns the user's
network logon name, not the UserName listed in Tools, Options,
General.
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"mikeburg"
wrote in
message
...
I am trying to execute code in BeforeSave in ThisWorkbook when
the
user's name is Mike. I tried the following but it does not
work
If Environ("UserName") = "Mike" then Msgbox Environ("UserName")
I also tried the following but it does not work either:
User = Environ("UserName")
If User = "Mike" Then MsgBox User
I must not be using the correct syntax. Can someone help?
Thanks a
lot. mikeburg
--
mikeburg
------------------------------------------------------------------------
mikeburg's Profile:
http://www.excelforum.com/member.php...o&userid=24581
View this thread:
http://www.excelforum.com/showthread...hreadid=508723