Formula for Excel User Name

G

Guest

Hi

I was just wondering if there was a formula to get the Excel User Name to
print.

I have a document that many users over a network use. At the moment there
is a cell in the document that automatically enters todays date but I
wondered if there was a way to automatically enter the user as well. I have
tried =Username() but this was just wishful thinking.

Any help would be appreciated. Thanks.
 
G

Gord Dibben

User Defined Function........

Function User()
Application.Volatile
User = Application.UserName
End Function

This function would be copied to a general module in your workbook.

If not familiar with macros and VBA, visit David McRitchie's website on
"getting started".

http://www.mvps.org/dmcritchie/excel/getstarted.htm

In the meantime..........

To create a General Module, hit ALT + F11 to open the Visual Basic Editor.

Hit CRTL + R to open Project Explorer.

Find your workbook/project and select it.

Right-click and Insert>Module. Paste the above code in there. Save the
workbook and hit ALT + Q to return to your workbook.

In a cell enter =User()


Gord Dibben Excel MVP
 
B

Bob Phillips

Would you care to enlighten me as to what this has to do with the question
:)

Bob
 
H

Harlan Grove

Gord Dibben wrote...
User Defined Function........

Function User()
Application.Volatile
User = Application.UserName
End Function
....

This only returns the user name entered when Excel or Office was
installed, and in many remote corporate installs that's not the user
name. And in some benighted companies, users are explicitly warned not
to modify this using Tools > Options, General tab.

More reliable to use

http://groups-beta.google.com/group/comp.apps.spreadsheets/msg/ff1a98111e7cd5d7?dmode=source&hl=en

(or http://makeashorterlink.com/?R2156222B ).
 
G

Guest

At my last place of work i had a printing problem with a spreadsheet on one
of three computers which acessed a quote sheet over the network.I identified
the user by name using one of those formulas and then made some if then
statement sin my macro......
 
D

David McRitchie

Paul's suggestion for =INFO("directory")
might kind of work if each user keeps their own files on a network drive in
their own area, but chances are if a macro needs to check who is using a file that several
users are using he same file. However, after being challenged it might have
been wiser to check out the other solutions and see what they had to offer.

Also the use of =cell("filename") as supplied is pretty much useless for anything
including the pathname of the active workbook. See paragraphs in italics at the top of
http://www.mvps.org/dmcritchie/excel/pathname.htm
you need to include a reference cell address, and as Bob indicated it does not
answer this question.

Some information on obtaining the userid and related information can be found in
http://www.mvps.org/dmcritchie/excel/userid.htm
but the specific question has already been answered by three people earlier in the thread.
 
G

Guest

sheesh guys i did say MIGHT help,in my limited eperiene the user name was
included in the =info(directory)......I stand corrected :(
--
paul
remove nospam for email addy!



David McRitchie said:
Paul's suggestion for =INFO("directory")
might kind of work if each user keeps their own files on a network drive in
their own area, but chances are if a macro needs to check who is using a file that several
users are using he same file. However, after being challenged it might have
been wiser to check out the other solutions and see what they had to offer.

Also the use of =cell("filename") as supplied is pretty much useless for anything
including the pathname of the active workbook. See paragraphs in italics at the top of
http://www.mvps.org/dmcritchie/excel/pathname.htm
you need to include a reference cell address, and as Bob indicated it does not
answer this question.

Some information on obtaining the userid and related information can be found in
http://www.mvps.org/dmcritchie/excel/userid.htm
but the specific question has already been answered by three people earlier in the thread.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top