Pin Me

Add Field Codes to Footers in MS Word

written by: Darrin Koltow•edited by: Michele McDonough•updated: 5/26/2011

This article teaches readers how to add field codes to footers in MS Word documents. That task enables Word users to apply field codes to paginate their documents and enable other automatically created text.

  • slide 1 of 4

    Adding Page Numbers

    One of the most common and simplest ways of adding field codes to footers is to add page numbers. To add page numbers in Word 2007, do the following:

    Choose Insert>Page number>Bottom of page, then click one of the formats from the large gallery. (Click any image for a larger view.)

    Inserting a page number 

    To verify that what you've inserted is a field code, double-click the page number, then select Toggle Field Codes. Word will show you this:

    { PAGE \* MERGEFORMAT}

    The curly braces, the backslash and the bold lettering all tell you that this is a field code. Hide the code by right-clicking anywhere in it and choosing Toggle field codes.

    Customizing the Field Code

    Here's one way of customizing the page number code you entered: Double-click the page number and choose Edit field. In the Field Properties pane at the center of the Field dialog box, choose a new format such as Roman numerals ("I, II, III," etc.). Click OK to update the field with the new format.

    Changing the page number format 

    Read more about managing footer page numbers from How to Insert Page Number Totals in the Header or Footer.

  • slide 2 of 4

    Adding Other Field Codes Besides Page Numbers

    There are many other types of field codes besides page numbers that you can insert in footers. Here's how to insert the name of the document's author:

    • Open up the footer for editing by selecting Insert>Footer>Edit footer.
    • Choose Insert>Quick Parts>Field.
    • Scan through the list of Field names and select Author, then click OK. Word updates your footer with the author's name.

    Adding the author's name 

    Tip: if you've never inserted the author's name before, Word will use the name entered by whoever installed Word on your computer. You can change that name by doing this: Press the Microsoft Office button and select Prepare>Properties. Enter the author's name in the window that appears. Close the window, then update the document's field codes to see the change you just made: Double-click the field code in the footer, press control-A, then F9. Word will show the changed author's name.

  • slide 3 of 4

    Inserting Merge Field Codes in the Footer

    Let's say you're producing reports or stationary for several different divisions of a company, and need to customize the footers of each division's stationary with the division's name. This is a mail merge situation, and mail merge is all about field codes.

    With the above scenario in mind, create the letterheads for each division as follows:

    Create the table of division names: select Insert>Table and choose 1 column by 4 rows for the table's dimensions.

    Fill the table with this data:

      • Divisions
      • Research and Development
      • Corporate
      • Alpha Corporation

      The first row is the row header.

      • Save the document as data.docm and close it.
      • Select Mailings>Start mail merge>Step by step mail merge wizard.
      • In the Wizard that appears, choose "Letters," "Use the current document," "Use an existing list (for recipients)".
      • Browse for the recipient list. In the Select Data Source dialog, filter the data sources to just Word files and open the data.docm file you saved earlier. Click OK in the Mail Merge Recipients dialog box.
      • Click the merge wizard link "write your letter".
      • Select Insert>Footer>Edit Footer, then Mailings>Insert merge field. Select the one field you created earlier: Divisions.
      • Click the merge wizard's "preview your letters," followed by clicking the << and >> arrows as you watch the field code fill with the various Divisions you entered.

      Inserting a footer field code for mail merges 

      Learn more about Word's Mail Merge tool from Use Mail Merge in Microsoft Word.

    • slide 4 of 4

      Insert Footer Field Codes Programmatically

      You can use Visual Basic for Applications to insert footer field codes programmatically. The following macro code gives an example of this. It creates a link (a type of field code) between the word that currently contains the insertion point, to the footer of the first section of your document. You might use such a macro to quickly insert a keyword from the main section of your document into the footer.

      You can enter install and run this program by doing the following:

      • Inside Word, press alt-F11 to bring up the Visual Basic Integrated Development Environment.
      • In the Project pane, double click the ThisDocument icon for the document you want to install the macro in.
      • Paste the following code into a blank space in the code window.
      • Return to Word, and enter a few words in the document.
      • Position the cursor in one of the words, then press alt-F8 to bring up the macro list.
      • Double-click the macro named "mklink".
      • The macro links the current word to the document's footer.

      Sub mklink()

      Dim w As Range

      Dim p As String

      Dim q As String

      Dim s As String

      '''''''''''''''''''''''

      ' select current word

      Set w = Selection.Range

      w.Expand

      'bookmark it

      ActiveDocument.Bookmarks.Add Range:=w, Name:="bm"

      'create the link field code text

      p = ActiveDocument.FullName

      q = Replace(p, "\", "\\") 'Must escape filename backslashes

      s = "link word.document.12 " & q & " bm \a \r"

      'Put field code in footer

      With ActiveDocument.Sections(1)

      .Footers(wdHeaderFooterPrimary).Range.Fields.Add Range:=.Footers(wdHeaderFooterPrimary).Range, Text:=s

      End With

      End Sub

      Learn more about Word macros from this Bright Hub article.