by Allen Wyatt
(last updated February 17, 2020)
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:
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.
Do More in Less Time! Are you ready to harness the full power of Word 2013 to create professional documents? In this comprehensive guide you'll learn the skills and techniques for efficiently building the documents you need for your professional and your personal life. Check out Word 2013 In Depth today!
When processing a document using a macro, you may need to know the precise size of a particular file. The way you figure ...Discover More
Need to create a directory from within a macro? You can do it using a single command line, as detailed in this tip.Discover More
Want to know the absolute value of a number? It's easy to derive in VBA by using the Abs function.Discover More
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
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.
Visit the WordTips channel on YouTube