add button to add file and path to the footer.

Posted on 2012-08-27
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
    LVL 59

    Expert Comment

    by:Chris Bottomley
    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

    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

    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

    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:

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    I would like to show you some basics you can do with Mailings in MS Word. It´s quite handy feature you can use for creating envelopes, labels, personalized letters etc. First question could be what is this feature good for? Mailing can really he…
    A few years ago I was very much a beginner at VBA, and that very much remains the case today.  I'll do my best to explain things as I go in the hope that other beginners can follow.  If you just want to check out a tool that creates a Select Case fu…
    This video teaches the viewer how to align pictures around text while keeping the text properly aligned in the document.
    This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.

    761 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

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now