Display a Word document's full path in the title bar

Displaying a Word document's name and full path in the title bar can be helpful -- and a little VBA will quickly take care of the job.

When you open a new document, Word displays a generic name in the title bar — documentx. Once you give the document a meaningful name (by saving it), Word updates the name in the title bar. However, in both cases, Word displays only the filename. It won't display the full path to the document.

Fortunately, most of us don't care what's in the title bar, but for if you do, VBA is your answer. A simple macro will update the contents of the title bar to display the document's name and path. To add this macro to a document (you can also add it to the template so that every new document you create includes the macro), do the following:

  1. With the file open, press [Alt]+[F11] to open the Visual Basic Editor (VBE).
  2. Add the following auto macro to the This Document module:Sub AutoOpen() 'Display document name and path in the title bar. ActiveWindow.Caption = ActiveDocument.FullName
    End Sub


  3. Return to the Word document, then save and close it.
  4. Open the document. This will trigger the auto macro, which displays the document's full pathname in the title bar.

The security setting could delay the display, but only temporarily. With all but the lowest setting, Word prompts you to enable macros when you open the document. As soon as you do so, Word will run the auto macro and update the title bar. Since this is an auto macro that runs only when you open the document, Word won't update the contents in the title bar when you save the file. If that's a problem, add a second macro to respond to your save tasks. Open the document's module and add the following macro to ThisDocument: Sub FileSaveAs() 'Display document name and path in the title bar. If Dialogs(wdDialogFileSaveAs).Show = 0 Then Exit Sub System.Cursor = wdCursorNormal ActiveWindow.Caption = ActiveDocument.FullName End Sub You'll need both macros for a complete fix: The first macro updates the title bar when you open the document and the second updates when you rename the document.

About Susan Harkins

Susan Sales Harkins is an IT consultant, specializing in desktop solutions. Previously, she was editor in chief for The Cobb Group, the world's largest publisher of technical journals.

Editor's Picks