Field codes: Ref field

{ [REF] Bookmark [Switches ] }

Inserts the text or graphics represented by the specified bookmark (bookmark: A location or selection of text in a file that you name for reference purposes. Bookmarks identify a location within your file that you can later refer or link to.). The bookmark must be defined in the active document (active document: The document in which you're working. Text you type or graphics you insert in Microsoft Word appear in the active document. The title bar of the active document is highlighted.). To insert bookmarked text or graphics from another document, use the INCLUDEPICTURE or INCLUDETEXT field. The Cross-reference command (Insert menu, Reference command) inserts REF fields to create cross-references.

In most cases, you can use the bookmark name instead of the REF field. Using the REF field is optional except in cases where a bookmark name matches a Microsoft Word field name. For example, if the bookmark name is "Title", which matches the Word field name TITLE, you must use the REF field instead of the bookmark name. The field { REF Title } inserts the text represented by the "Title" bookmark, whereas the field { Title } inserts the contents of the Title box on the Summary tab in the Properties dialog box (File menu).

 Note   When you insert text copied from another location in the same document, the Paste Special command (Edit menu) inserts a REF field with the bookmark INTER_LINKn, where n is incremented automatically. You should not edit an INTER_LINKn bookmark in a REF field. Also note that REF fields with INTER_LINKn bookmarks in a mail merge main document can cause errors during merging.

ShowInstructions

Bookmark

The name of a bookmark. If the text marked by the bookmark contains a paragraph mark (paragraph mark: The nonprinting symbol that Microsoft Word inserts when you press ENTER to end a paragraph. The paragraph mark stores the formatting you apply to the paragraph.), the text preceding the REF field assumes the formatting of the paragraph in the bookmark.

ShowSwitches

\d

Specifies the characters that separate sequence numbers (such as chapter numbers) and page numbers.

\f

Increments footnote, endnote, or annotation numbers that are marked by the bookmark and inserts the corresponding note or comment (comment: A note or annotation that an author or reviewer adds to a document. Microsoft Word displays the comment in a balloon in the margin of the document or in the Reviewing Pane.) text. For example, the bookmark "Note1" marks the reference mark of footnote 1. The field { REF Note1 \f } is inserted after footnote 2. The field result (field results: Text or graphics inserted in a document when Microsoft Word carries out a field's instructions. When you print the document or hide field codes, the field results replace the field codes.) displays the footnote reference mark "3" in the document text and inserts the text of footnote 1 into the footnote window.

\h

Creates a hyperlink (hyperlink: Colored and underlined text or a graphic that you click to go to a file, a location in a file, a Web page on the World Wide Web, or a Web page on an intranet. Hyperlinks can also go to newsgroups and to Gopher, Telnet, and FTP sites.) to the bookmarked paragraph.

\n

Causes the field to display the entire paragraph number for a referenced paragraph without trailing periods. No information about prior levels is displayed unless it is included as part of the current level.

\p

Causes the field to display its position relative to the source bookmark using the word "above" or "below."

If the REF field appears in the document before the bookmark, it evaluates to "below." If the REF field appears after the bookmark, it evaluates to "above." If the REF field appears within the bookmark, an error is returned.

This switch can also be used in conjunction with the \n, \r, and \w switches. When this is done, "above" or "below" is appended to the end of the field result.

\r

Inserts the entire paragraph number of the bookmarked paragraph in relative context — or relative to its position in the numbering scheme — without trailing periods.

\t

Causes the REF field to suppress non-delimiter or non-numerical text when used in conjunction with the \n, \r, or \w switch.

With this switch, for example, you can reference "Section 1.01," and only "1.01" is displayed in the result.

\w

Inserts the paragraph number of the bookmarked paragraph in full context from anywhere in the document.

For example, when referencing paragraph "ii.," a REF field with the \w switch would return "1.a.ii" as a result.

ShowExamples

The following REF field assigns the result of an ASK field that prompts the user for the cost per unit. The ASK field prompts the user for information when the field is updated and then assigns the user's input to the bookmark "unitcost":

{ ASK unitcost "What's the cost per unit?" }

{ REF unitcost }

 
 
Applies to:
Word 2003