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.
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!
Need to repeat an action a whole bunch of times? You can do it a time or two using keyboard shortcuts, but you'll need a ...Discover More
If you are working with a document that includes footnotes, you might use a macro to do some processing of that document. ...Discover More
Functions can be used to perform repetitive tasks and return values to your main program. You can also pass values to a ...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.