Displaying the User Name in the Status Bar or Title Bar

by Allen Wyatt
(last updated November 29, 2014)

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.)

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

Referring to the Last Cell

It is not unusual to use worksheets to collect information over time. As you keep adding information to the worksheet, you ...

Discover More

Replacing Background Colors in Cells

Want a quick way to replace background colors in cells? It's easy to do using Find and Replace, or you can simply use the ...

Discover More

Excel 2010 Conditional Formatting (Table of Contents)

Conditional formatting allows you to modify how information is displayed based upon criteria that you define. Excel 2010 ...

Discover More

The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2013. Spend more time working and less time trying to figure it all out! Check out Word 2013 For Dummies today!

More WordTips (ribbon)

Modifying Behavior of the Open Dialog Box

The Open dialog box is one that few of us think about, but you can control how it behaves with a little bit of macro coding. ...

Discover More

Moving Through a Table in a Macro

Do you need to step through a table, cell by cell, in a macro? It's easy to do using the Move method, as described in this ...

Discover More

Determining the Hour of the Day

Need to figure out the hour represented by a particular time value? It's easy to do in a macro; just use the Hour function, ...

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}] 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 0 + 6?

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.

Newest Tips
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.