Displaying the User Name in the Status Bar or Title Bar

Written by Allen Wyatt (last updated March 10, 2023)
This tip applies to Word 2007, 2010, and 2013


6

Christopher wonders if there is any way to display the current user name automatically in the Word status bar or the title bar. As a freelance text reviewer he often has to change the user name in order to use Track Changes for a particular job, and then he has to remember to reset it before creating a document or using Track Changes for a different client. If Christopher forgets, it can cost him time and embarrassment. He feels that having the user name displayed in the status bar or the title bar would be a useful reminder.

Adding the information to the status bar is actually fairly easy. All you need to do is include a single line in your macro, such as this:

Application.StatusBar = Application.UserName

The macro grabs the value of the UserName property from the Application object (which represents Word itself) and then stuffs that information into the StatusBar property. Simple, right?

There are a couple of problems with this, however. The biggest problem is that Word uses the status bar for lots of things, which means that whatever you place there won't remain there for long. For instance, all you need to do is type a single character and Word overwrites whatever you placed on the status bar.

Unfortunately, Word doesn't provide any built-in event handlers that could trigger a resetting of the status bar. You could, of course, create a timer-based macro that would periodically update the status bar with the user's name, but that could be distracting because it would lead to flashing as your macro and Word wrestle for what is displayed there.

You should also know that Microsoft has apparently deprecated the StatusBar property in Word 2013:

http://msdn.microsoft.com/en-us/library/office/ff845291%28v=office.15%29.aspx

I say "apparently" because this deprecation is a bit confusing. Testing shows that the StatusBar property works just fine in Word 2013, just as in previous versions of the program. (Perhaps it will be fully removed in the next version of Word, but who knows?)

Because of these drawbacks, it may be a better choice to add the user's name to the title bar. The following macros will do the trick:

Sub AutoOpen()
    ActiveWindow.Caption = ActiveWindow.Caption & "  User: " & _
      "  User: " & Application.UserName
End Sub
Sub FileSaveAs()
    If Application.Dialogs(wdDialogFileSaveAs).Show Then
        ActiveWindow.Caption = ActiveWindow.Caption & _
          "  User: " & Application.UserName
    End If
End Sub

The macros add the user name to the end of the filename in the window title bar when the document is first opened and whenever the Save As command is used. (The title bar is overwritten by Word when the document filename is changed.)

Note:

If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (13321) applies to Microsoft Word 2007, 2010, and 2013.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Automatically Saving Versions

The versioning feature in Word can be very handy as you develop your documents. Here's how to set it up so that a new ...

Discover More

Turning Off Error Checking

A little green triangle in the corner of a cell means that Excel thinks there is an error with the cell contents. If ...

Discover More

Controlling Names of Backup Files

Want to control the name and location of your document backup? Here are some ideas that may help.

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More WordTips (ribbon)

Trimming Spaces from Strings

When processing text with a macro, you often need to remove extraneous spaces from the text. VBA provides three handy ...

Discover More

Determining If a Number is Odd or Even

Need to know if a number in a macro is odd or even? It's easy to figure out with the simple calculation shown in this tip.

Discover More

Understanding the If ... End If Structure

One of the powerful programming structures provided in VBA allows you to conditionally execute commands. The If ... End ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is two more than 7?

2015-03-31 15:07:36

Rusty Perrin

Argh--last note, I promise. Where I said "keep the parentheses" I meant "keep the quotation marks". Sorry for any confusion.


2015-03-31 15:06:21

Rusty Perrin

One other note--where I say "My Name" below, that should be replaced with whatever you've told Word you are (but keep the parentheses). So in my case, it would instead be "Rusty Perrin".


2015-03-31 15:03:33

Rusty Perrin

A little dated reply, but note for Ken's 11/29 response that the change to make it show the last author might be something useful, but it is different than what the original poster was asking. The issue is when you are basically lying to Word about who "you" are. So you are telling it you are someone else, then going into change tracking to put edits in on their behalf. Then ideally, you change it back, but sometimes you forget. So what happens then is that a few days later you are making changes in some other document using track changes and thinking they are claiming to be from you, but instead they are showing up as being from the other person.

So I would stick with Application.UserName rather than changing to ActiveDocument.BuiltInDocumentProperties(wdPropertyLastAuthor). An additional improvement is I would add an If statement so that it only shows the name in the title bar if it is different from my actual name. So before both of the ActiveWindow.Caption lines, I'd add

If Application.UserName <> "My Name" Then

and put an EndIf after it. I also, to draw more attention to it, put a bunch of bullet characters before and after, so it stood out a bit more. Ideally, I'd like to put a red background behind it or at least make the text red, but I haven't figured out how to do that.

Lastly, one additional trigger point to update the title bar would be whenever you go in and change your user name and/or initials in Word. Anyone know how to make that happen?

Thanks, Rusty


2014-12-02 07:45:30

Ken Endacott

Application.Username is the current Word user i.e. you.

ActiveDocument.BuiltInDocumentProperties(wdPropertyLastAuthor) is the user who last saved the document.


2014-12-01 09:32:18

rpurosky

I'm just a little confused about a key element here. Aren't YOU the current user when in a document? Won't the status bar or title bar just display my UserName? I see KE's comment uses wdPropertyLastAuthor. Is this really addressing the UserName of the user who last modified? I may just not fully understand Application.UserName.


2014-11-29 04:26:59

Ken Endacott

Under some circumstances the macros that add the user's name to the title bar can raise errors. By adding an on error statement the problem can be overcome. The macros then become:

Sub AutoOpen()
On Error Resume Next
ActiveWindow.Caption = ActiveWindow.Caption & _
" Author=" & ActiveDocument.BuiltInDocumentProperties(wdPropertyLastAuthor)
End Sub

Sub FileSaveAs()
On Error Resume Next
If Application.Dialogs(wdDialogFileSaveAs).Show Then
ActiveWindow.Caption = ActiveWindow.Caption & _
" Author=" & ActiveDocument.BuiltInDocumentProperties(wdPropertyLastAuthor)
End If
End Sub


This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.

Videos
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.