by Allen Wyatt
(last updated November 29, 2014)
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.
Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!
When a macro works with files, it often has to change between different directories on your disk drive. This is done using ...Discover More
Macros are part of the document and template that are loaded into memory when you open a file. If you have "junk" macros in ...Discover More
Do you need to do some simple math using dates in a your macro? One of the easy functions you can use is the DateDiff ...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.