add button to add file and path to the footer.

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?
mspencer100Asked:
Who is Participating?
 
tdlewisConnect With a Mentor Commented:
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:
http://office.microsoft.com/en-us/word-help/customize-the-quick-access-toolbar-HA001234105.aspx
0
 
Chris BottomleySoftware Quality Lead EngineerCommented:
Yes what version of word and where would the data go in the footer ... and what to do if something already exists?

Chris
0
 
tdlewisCommented:
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()
    WordBasic.ViewFooterOnly
    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.
0
 
mspencer100Author Commented:
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.