Microsoft KB Archive/136259

= 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:

 On the File Menu, click Open. In the List Files of Type list, click Document Templates. Select the folder where your templates are stored (for example, C:\MSOffice\Templates or C:\Winword). Click the Normal template (Normal.dot), and click Open. 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. Press CTRL+F9 (Windows) or COMMAND+F9 (Macintosh) to insert a field.</li> 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.</li> On the File menu, click Save. Close the file.</li></ol>

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

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.