PDA

View Full Version : Solved: Username not updating



Phelony
08-25-2011, 06:22 AM
Hi guys

I've got a function for usernames, pretty basic:


Function getusername()
getuser = (Environ$("Username"))
getusername = getuser
End Function


and works fine when used in it's spreadsheet.

So then I've got the formula ="Welcome "&getusername()

Problem is, when the spreadsheet is e-mailed or opened on any other computer, it's not updating, so this thing is going all over the place with my name instead of the actual users name.

I've tried putting in a calculate order when the workbook opens, calculation for the sheet is set to automatic and I'm now a bit :banghead: as to why it's not updating itself.

Any ideas? :dunno

Phel

Kenneth Hobs
08-25-2011, 06:51 AM
Application.Volatile

Environ("username") only gets that the environment variable value. This could be overridden. An API method would be more reliable. There is another method were we could get the Full Name or the given name which is just the first and last name.

Phelony
08-25-2011, 06:53 AM
Application.Volatile

That's my "something new learned" for today!

Thanks Ken :friends:

Edit - Curious about the other method you mentioned however regarding the proper names. Don't suppose you could point me in a direction to investigate further?

Bob Phillips
08-25-2011, 07:02 AM
Environ("username") only gets that the environment variable value. This could be overridden.

Really? How?