StyleRef Field Tutorial - Microsoft Word

StyleRef Field in Microsoft Word - a Tutorial

You can download a free short tutorial on how to use the StyleRef field in Microsoft Word. (Short macro-free Word docx file)

The StyleRef field can be used to work around some limitations in Word since styles are far less fragile in Word documents than are bookmarks. The primary use of the StyleRef field is to provide headers and footers that summarize the contents of a page. Sometimes they are used with the \l switch to provide phone-book style headers/footers which list both the first and the last occurrence of a style.

Using the STYLEREF Field to create dictionary-style headers/footers

Are you trying to get dictionary style fields (Krofta - Lamb) listing the
first and last entry on your page?

If that is what you are trying for, the following will work:
Put your last name field (or whatever it is you are trying to capture) in a particular character style in your primary merge document. In the header/footer use
two STYLEREF fields with an optional switch on the last one to tell it to search from the bottom of the page instead of the top. STYLEREF fields probably don't show up in the mailmerge toolbar.

Insert => Field... => Links and References (left window) => STYLEREF (bottom of right window) => Options (button)

Look in help for "dictionary-style headers."

You can name the character style anything you want and it should be based on your default character font with no changes. You are using the style as a tag rather than as a way of formatting. Remember, this new style is a character style rather than a paragraph style.

This is especially useful when you have something on the first page of a document which, if changed, should be reflected in continuation page headers or footers. Examples: the addressee name, the subject, the date. Useful StyleRef Field Tricks - Suzanne S. Barnhill, MVP

If you are doing this in a mail-merge, you may have to insert the header after you do the merge. Try inserting it before you do the merge, if that doesn't work, then try after. (I haven't tried this with a mail merge but it should work. After you get results, please share them by letting me know so I can update this.

Using the STYLEREF Field and Styles instead of Bookmarks and Ref fields

{ StyleRef "MyStyle" } instead of { Ref "MyBookmark" }

If your have a single word or a phrase in a document marked in the character style "MyStyle" that word or phrase will be reflected in this field's results, instantly. This updates in headers and footers as well as in the body when the marked text is changed. It is much more robust than bookmarks which are easily deleted by accident. See Letterhead Textboxes and Styles Tutorial - two page Word document demonstrating StyleRef and Author fields, among other things.

Either a character style or a paragraph style will work with the StyleRef field. The style does not have to change any formatting - it can just serve as a marker for the field. In the tutorial the styles used do have formatting functions as well -- primarily the paragraph spacing and the designation of the following style.

The Built-In styles have language-independent constants that can be used to refer to styles in the StyleRef field.

For instance, the built-in Heading styles Heading 1 - Heading 9, can be referred to simply using the number. (The word for "Heading" and thus the style name is different in different lanugages.) See STYLEREF Fields and Language-specific Style Names by Lene Fredborg, MVP and Why Use Word's Built-In Heading Styles? by Shauna Kelly.

A secondary use is within the document itself when you want to include text from a heading (or other style) elsewhere in the document and want that text to change depending on the heading.

See also Useful StyleRef Tricks by Suzanne Barnhill.

Exit Links:

download the StyleRef Field Tutorial

download the Letterhead Textboxes and Styles Tutorial

See also: Dealing with Fields in Microsoft Word


Flying Pillcrow (paragraph mark) - trademark of ADD Balance Word websitesReturn to Frequently Asked Questions List  

Go to Web Resources for Microsoft Word

Go to Microsoft Word Downloads page

Blue Scales - Represents ADD Balance supplemented version of Legal Users' Guide to Microsoft Word. Click on the scales to go to the Users' Guide Table of Contents. Go to
Intermediate Users' Guide

to Microsoft Word
(formerly Supplemented Legal Users' Guide)

 The up-to-date version of this FAQ may be found at: Pillcrow (paragraph mark) - trademark of ADD Balance Word websites

Information about books on Microsoft Word


Using Date Fields in Microsoft Word
Calculated Dates
Booklet Formatting and Printing in Microsoft Word
Changing the Default Font in Microsoft Word
Document linked to Printer in Microsoft Word
Fonts Missing from Menu in Microsoft Word
How can I get a different header / footer on the second page?
Heading? Header? Microsoft Word Help
More on Headers and Footers in Word
I want the filename in the footer of every document.
Margins Missing - White Space
Mapped Content Controls and Document Properties
Moving/Reorganizing Pages in Microsoft Word
Print Preview in Microsoft Word
Weird Lines and Borders
Macros and VBA
Malicious Macros vba in Microsoft Word
Master Documents Feature in Microsoft Word
A Back CoverPage in Microsoft Word
Normal Template in Microsoft Word - How to Open or Find the Normal Template
My docs open in the wrong program! Re-registering Word using the commandline.
Moving (Sharing) Customizations in Microsoft Word
Global StyleSheet?
MVP means?
Naming Files - A System is the Key
Posting tips in the Microsoft Word Forums
Getting rid of that (*)#"@^ paperclip! - Taming the Office Assistant
Page X of Y doesn't work in Microsoft Word!
Save Changes to the Global Template? Keeps Popping Up
Templates in Microsoft Word
Global Templates
Too Many Icons on the Taskbar in Microsoft Word 2000
Getting Rid of the Web Toolbar in Microsoft Word
Word for Word Perfect Users
Favorite Documents Menu
Work Menu in Microsoft Word
Spell Check Dialog Instead of Editor
Templates Menu in Microsoft Word
What books have been recommended about Microsoft Word?
Where can I find more templates?
Word Links

Click to return to table of contents page of Intermediate User's Guide to Microsoft Word.Click to go to Microsoft Word new users frequently asked questions site in a new browser window.
(Intermediate Users' Guide) - - - - - - - - - - - - - - - - - - -  (Questions List)

Word Tutorial - Intermediate
Legal Users Guide to Word
Books about Microsoft Word - Newsgroup suggestions
Web Resources for Microsoft Word