Link to home
Create AccountLog in
Avatar of camtz
camtzFlag for United States of America

asked on

Directory for Word documents

Is there a way to have Word, Excel show the directory at the top of the page so that I know where the document is stored on the computer using Windows 10? Thanks
Avatar of NVIT
Flag of United States of America image

There doesn't seem to be a built-in way to do that. You'll need to use a macro.

There are a couple of ways that this can be approached. If you only need to know the full path name once in a while, then you can create a very simple macro and assign it to a toolbar button. When you click on the button, the information in the title bar for the active window is changed to reflect the full path name. This macro, called ChangeCaption, is as follows:

Sub ChangeCaption()
    ActiveWindow.Caption = ActiveDocument.FullName
End Sub

Open in new window

There are a couple of big drawbacks to this option, however. Whenever you rename the document by using Save As to save it under a different name, the new file name (and path) are not updated in the title bar unless you rerun the macro. Secondly, if you have virus checking turned on, then it may interpret your macro (assigned to AutoOpen) as an attempt by a macro virus to mess with your system.

There is a way to create a more comprehensive and automatic approach... Essentially, the steps used in accomplishing this approach are as follows:
1. Set up Word to trigger application events (they're built in to Word, but they don't happen automatically).
2. Write some the actual title-bar changing code for the DocumentChange event.

Then explains how to setup the approach, including related macro code.
In Word, use Insert>Quick Parts>Field and choose Filename. Check the box in the dialog to add the path. Place this in the page header to display it on every page. Add it to your Normal.dotm template to ensure it appears in every document.

In Excel, choose the Page Layout tab, then open the Page Setup dialog. Click on the Header/Footer tab, then click on Custom Header. Click on the Insert File Path button, which adds both the path and file name to the header. Repeat for each worksheet where you want the info to appear. If you save the resulting file in the Excel Startup directory and call it book.xltx, the file name and path with appear on all new workbooks without any effort on your part.
Avatar of Paul Sauvé
Paul Sauvé
Flag of Canada image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of camtz


Paul, I have looked for Quick Access Toolbar in Word but can't find it.  Sending a pic of what mine looks like.  Can you give me more instructions please.User generated image
In Word 2007, click on the Customize option to find the QAT commands.
perhaps also from here:User generated image
Avatar of camtz


Thank you, I found it.