Microsoft KB Archive/136259

From BetaArchive Wiki
Knowledge Base


WD: How to Print a Field Result on the Last Page of a Document

Article ID: 136259

Article Last Modified on 8/17/2005



APPLIES TO

  • Microsoft Word 6.0 for Macintosh
  • Microsoft Word 6.01 for Macintosh
  • Microsoft Word 6.01 for Macintosh
  • Microsoft Word 95 Standard Edition
  • Microsoft Word 95a
  • Microsoft Word 6.0 Standard Edition



This article was previously published under Q136259


SUMMARY

This article describes how to automatically place the file name of the current document (or any other field result) on the last page of every document based on the Normal template.

MORE INFORMATION

To place the file name on the last page of every document based on the Normal template, follow these steps:

  1. On the File Menu, click Open.
  2. In the List Files of Type list, click Document Templates.
  3. Select the folder where your templates are stored (for example, C:\MSOffice\Templates or C:\Winword).
  4. Click the Normal template (Normal.dot), and click Open.
  5. On the View menu, click Header and Footer.

    The first button on the left on the Header and Footer toolbar toggles between the header and footer. Toggle to the one that you want the field to appear in.
  6. Press CTRL+F9 (Windows) or COMMAND+F9 (Macintosh) to insert a field.
  7. Type the following in the field brackets

    if { page }={ numpages } "{ filename \p }"

    so that the field looks like this:

    { if { page } = { numpages } "{ filename \p }" }

    NOTE: The \p switch causes the entire path to the file name to be included.

    NOTE: The field brackets are actual fields and the code should not be copied. They should be entered as separate fields, i.e. each set of brackets corresponds to a field.
  8. On the File menu, click Save. Close the file.

The If field determines whether the current page equals the number of pages in the document. This field is present in the header or footer on every page in the document. However, the file name will be printed only on the final page of the document. These steps can be used with any field (that is, you can substitute another field code for File name if you want different results to print, such as the date).


Additional query words: repeat

Keywords: kbhowto kbfield KB136259