add button to add file and path to the footer.

Posted on 2012-08-27
Medium Priority
Last Modified: 2012-09-11
i would like  to add a button to word menu bar that will automatically (when clicked) add the file name and path to the footer of the active document. any way to get this done?
Question by:mspencer100
  • 2
LVL 59

Expert Comment

by:Chris Bottomley
ID: 38339491
Yes what version of word and where would the data go in the footer ... and what to do if something already exists?

LVL 10

Expert Comment

ID: 38339499
Before I give you the answer, keep in mind that every section of a document potentially has three footers: first page, odd page, even page. The following macro assumes you have a single section that only uses the "primary" footer.

Sub SetFooter()
    Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, text:= _
        "FILENAME  \p ", PreserveFormatting:=True
    Selection.TypeText text:=vbTab
    Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, text:= _
        "PAGE  \* Arabic ", PreserveFormatting:=True
    ActiveWindow.ActivePane.view.SeekView = wdSeekMainDocument
End Sub

Open in new window

If you are running Word 2003 or later then you can run the macro from your Quick Access toolbar. First, add the subroutine above to your Normal template. Click the arrow at the end of the Quick Access toolbar and choose More Commands... From the "Choose Commands from" drop down, choose macros and then select the macro.

Also note that the macro doesn't have any error checking and doesn't do any formatting (such as tab stops) of the footer.

Author Comment

ID: 38341358
thanks, I but I don't know how to add it to the Quick Access toolbar. I looked "view" for the Quick Access menu but don't see it.

on the version it is word 2003, the footer should over ride anything that is already there, location would be bottom left.
LVL 10

Accepted Solution

tdlewis earned 2000 total points
ID: 38341582
I have highly customized my Quick Access toolbar. It now contains buttons for all the things I typically use in Word so that I don't have to constantly switch between ribbons.

See this article from Microsoft for instructions on customizing the toolbar:

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Selection object is designed for user interaction. It has a Range property, so it can be used in most places that a Range object can. Recorded macros must use the Selection because they are simply copying what the user is doing. A Range prope…
Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question