Click here for more information about the book at Amazon.com.


Click here for more information about the book at Amazon.com.


Click here for more information about the book at Amazon.com.

Click for information on Amazon.com about this book.

other books
about using Word

 

 

Flying Pillcrow - trademark of Madison Wisconsin Criminal Defense Lawyer Charles Kenyon'n Word sites - symbolizing the wish to make Word fly!

 

Users Guide
Tutorials

Basic Formatting

Complex Documents
Tables of Contents
Tables of Authorities
Cross-References

Confidentiality
and MetaData

Numbering

Sections and
Section Breaks

Headers and Footers

Styles

Boilerplate
Building Blocks
Autotext and Autocorrect

Tables

Track Changes
& Compare
Documents /

Merge Documents

Template Basics
Normal.dot

Troubleshooting

Document
Corruption

Third Party
Vendors
Directory

Flying Pillcrow - trademark of Madison Wisconsin Criminal Defense Lawyer Charles Kenyon'n Word sites - symbolizing the wish to make Word fly!

Use Google to
Search the
Usersguide to
Microsoft Word

 

 

 

 

Other Word
Links

Frequently
Asked
Questions

Books
about
Microsoft Word

Microsoft Word
Free
Downloads
:
Add-Ins
Tutorials
Templates

Links

 

Flying Pillcrow - trademark of Madison Wisconsin Criminal Defense Lawyer Charles Kenyon'n Word sites - symbolizing the wish to make Word fly!

 

 

This site maintained
as a hobby
as part of my
 criminal defense
attorney web site
 in
 Madison, Wisconsin.

 

 

 

Flying Pillcrow - trademark of Madison Wisconsin Criminal Defense Lawyer Charles Kenyon'n Word sites - symbolizing the wish to make Word fly!

 

Users Guide
Tutorials

Basic Formatting

Complex Documents
Tables of Contents
Tables of Authorities
Cross-References

Confidentiality
and MetaData

Numbering

Sections and
Section Breaks

Headers and Footers

Styles

Boilerplate
Building Blocks
Autotext and Autocorrect

Tables

Track Changes
& Compare
Documents /

Merge Documents

Template Basics
Normal.dot

Troubleshooting

Document
Corruption

Third Party
Vendors
Directory

Flying Pillcrow - trademark of Madison Wisconsin Criminal Defense Lawyer Charles Kenyon'n Word sites - symbolizing the wish to make Word fly!

Use Google to
Search the
Usersguide to
Microsoft Word

 

 

 

 

Other Word
Links

Frequently
Asked
Questions

Books
about
Microsoft Word

Microsoft Word
Free
Downloads
:
Add-Ins
Tutorials
Templates

Links

 

Flying Pillcrow - trademark of Madison Wisconsin Criminal Defense Lawyer Charles Kenyon'n Word sites - symbolizing the wish to make Word fly!

 

 

This site maintained
as a hobby
as part of my
 criminal defense
attorney web site
 in
 Madison, Wisconsin.

 

 

 

Click here for more information about the book at Amazon.com.


Click here for more information about the book at Amazon.com.


Click here for more information about the book at Amazon.com.

Click for information on Amazon.com about this book.

other books
about using Word

 

 

 

Flying Pillcrow - trademark of Madison Wisconsin Criminal Defense Lawyer Charles Kenyon'n Word sites - symbolizing the wish to make Word fly!

 

Users Guide
Tutorials

Basic Formatting

Complex Documents
Tables of Contents
Tables of Authorities
Cross-References

Confidentiality
and MetaData

Numbering

Sections and
Section Breaks

Headers and Footers

Styles

Boilerplate
Building Blocks
Autotext and Autocorrect

Tables

Track Changes
& Compare
Documents /

Merge Documents

Template Basics
Normal.dot

Troubleshooting

Document
Corruption

Third Party
Vendors
Directory

Flying Pillcrow - trademark of Madison Wisconsin Criminal Defense Lawyer Charles Kenyon'n Word sites - symbolizing the wish to make Word fly!

Use Google to
Search the
Usersguide to
Microsoft Word

 

 

 

 

Other Word
Links

Frequently
Asked
Questions

Books
about
Microsoft Word

Microsoft Word
Free
Downloads
:
Add-Ins
Tutorials
Templates

Links

 

Flying Pillcrow - trademark of Madison Wisconsin Criminal Defense Lawyer Charles Kenyon'n Word sites - symbolizing the wish to make Word fly!

 

 

This site maintained
as a hobby
as part of my
 criminal defense
attorney web site
 in
 Madison, Wisconsin.

 

 

Flying Pillcrow - trademark of Madison Wisconsin Criminal Defense Lawyer Charles Kenyon'n Word sites - symbolizing the wish to make Word fly!

 

Users Guide
Tutorials

Basic Formatting

Complex Documents
Tables of Contents
Tables of Authorities
Cross-References

Confidentiality
and MetaData

Numbering

Sections and
Section Breaks

Headers and Footers

Styles

Boilerplate
Building Blocks
Autotext and Autocorrect

Tables

Track Changes
& Compare
Documents /

Merge Documents

Template Basics
Normal.dot

Troubleshooting

Document
Corruption

Third Party
Vendors
Directory

Flying Pillcrow - trademark of Madison Wisconsin Criminal Defense Lawyer Charles Kenyon'n Word sites - symbolizing the wish to make Word fly!

Use Google to
Search the
Usersguide to
Microsoft Word

 

 

 

 

Other Word
Links

Frequently
Asked
Questions

Books
about
Microsoft Word

Microsoft Word
Free
Downloads
:
Add-Ins
Tutorials
Templates

Links

 

Flying Pillcrow - trademark of Madison Wisconsin Criminal Defense Lawyer Charles Kenyon'n Word sites - symbolizing the wish to make Word fly!

 

 

This site maintained
as a hobby
as part of my
 criminal defense
attorney web site
 in
 Madison, Wisconsin.

 

 

Flying Pillcrow - trademark of Madison Wisconsin Criminal Defense Lawyer Charles Kenyon'n Word sites - symbolizing the wish to make Word fly!

 

Users Guide
Tutorials

Basic Formatting

Complex Documents
Tables of Contents
Tables of Authorities
Cross-References

Confidentiality
and MetaData

Numbering

Sections and
Section Breaks

Headers and Footers

Styles

Boilerplate
Building Blocks
Autotext and Autocorrect

Tables

Track Changes
& Compare
Documents /

Merge Documents

Template Basics
Normal.dot

Troubleshooting

Document
Corruption

Third Party
Vendors
Directory

Flying Pillcrow - trademark of Madison Wisconsin Criminal Defense Lawyer Charles Kenyon'n Word sites - symbolizing the wish to make Word fly!

Use Google to
Search the
Usersguide to
Microsoft Word

 

 

 

 

Other Word
Links

Frequently
Asked
Questions

Books
about
Microsoft Word

Microsoft Word
Free
Downloads
:
Add-Ins
Tutorials
Templates

Links

 

Flying Pillcrow - trademark of Madison Wisconsin Criminal Defense Lawyer Charles Kenyon'n Word sites - symbolizing the wish to make Word fly!

 

 

This site maintained
as a hobby
as part of my
 criminal defense
attorney web site
 in
 Madison, Wisconsin.

 

 

 

 

Using { Fields } in Microsoft Word

ROUGH DRAFT - not ready for prime time - this is in the site right now primarily for the Additional Written Resources.

by Charles Kyle Kenyon, Esq.

There are no promises that this chapter is of the same quality and depth as the other chapters of this guide. That is because it was written by a single author not working with Microsoft and not subject to peer review. You will not find this chapter on the Microsoft site. Comments are welcome.

You should have reviewed the bookmarks and cross-reference portions of Complex Legal Documents before tackling this chapter. (Cross-references are one type of field.)

What You Will Learn

After completing this lesson, you will be able to:
bulletSee field codes and hide them
bulletType a field from the keyboard and have it work.
bulletCopy a field from a newsgroup or email message or book and have it work.
bulletInsert a date field.
bulletInsert calculated date fields.
bulletInsert a page number.
bulletInsert special page numbers and calculated page numbers.
bulletApply field switches to change how the field result appears on the page.
bulletInsert document information (properties) in your document body or headers and footers.
bulletUse a StyleRef field to copy information from the body to headers and footers.
bulletUse a StyleRef field instead of a Cross-Reference field.
bulletUse an ASK field, bookmarks and related cross-references.
bulletUse Function and ShortCut keys to manipulate fields
bulletUse AutoText entries for insertion of fields
bulletUse a MacroButton field for a simple user prompt.
bulletUse a MacroButton field to run a macro that you record.
bulletUse a MacroButton field to make a templates menu document.
bulletCreate dictionary-style headers / footers describing page contents.
bulletConvert field codes to ordinary text to discuss using email or online forums
bulletUse multiple Sequence fields in a document for pleadings or sequentially numbered tickets
bulletUse vba (Visual Basic for Applications -- Macros) to insert a nested field

Other Chapters Related to Topics Covered in this Lesson

bulletNumbering - Sequence Fields
bulletComplex Legal Documents (Footnotes, Endnotes, Bookmarks, Cross-References)

Additional Written (and Web) Resources

bullet Microsoft Support - Fields Reference - this is a great place to get a handle on fields or find a field. Organized by category and by field.
bulletMicrosoft Support - Fields Switches 
bulletMicrosoft Support - Insert and Format Field Codes in Word 2010
bulletThe mailmerge.fields newsgroup on the Microsoft news server.
bulletMVP FAQ index Fields
bullet Fields Revealed by Sherry Kappel of Microsystems.
bullet How to hide a "Print" command button on a Form so that it doesn't print by Ibby 
bullet Repeating Data - entering once and having it show up elsewhere! by Greg Maxey, MVP
bullet Toggling Data Display Using MacroButton Fields by Greg Maxey, MVP
bulletMicrosoft MailMerge Resource Center - MS site
bullet How the Behavior of the Word Fields Changes After You Install the Word Update KB330079 - Applies to Word 2000 and later - documents FieldCalcSecurityLevel registry key
bulletCindy Meister's Articles from Office Developer (now OfficeVBA) Magazine:
bullet Word Fields Part I : Automate Word Documents With Minimum Code
bullet Word Fields Part II : Numbering Conundrums
bullet Word Fields Part III : (Advanced) Using Events to Push the Envelope (Includes Index Hyperlinks!)
bullet Mail Merge - Part I - Introduction and Data Integration
bullet Mail Merge - Part II - Employing Word's Field and Formatting Capabilities
bullet Mail Merge FAQ - MVP site
bullet How to Create A Mail Merge by Beth Melton, MVP and Dave Rado, MVP 
bullet Making Your MailMerge Intelligent using IF Fields by Dave Rado, MVP
bullet Turning Word into a Pseudo-Database Using Mail Merge Query Options by Dave Rado, MVP
bullet How to do a mail merge to the printer using VBA, without displaying the Print dialog by Ibby, MVP
bulletMicrosoft Webcast - MailMerge Basics - 45 minutes
bulletMicrosoft Webcast - Intermediate MailMerge - 45 minutes
bullet Word Fields by Greg Maxey
bullet Working With Field Codes - Cindy Meister (part of her FAQ on Mail Merge) possibly included in her series of articles above - haven't analyzed
bullet Formatting Word Fields with Switches by Graham Mayor, MVP
bullet Word Field Calculations - you have to see this to believe it - manipulate fields to get what you want - by Paul Edstein (Macropod) - alternative download site on Graham Mayor's site
bullet Word Fields and Relative Paths to External Files by Paul Edstein
bullet Microsoft Word Field Maths Tutorial by Paul Edstein
bullet Field Code to String (and back) by Paul Edstein and Graham Mayor
bullet Page X of Y bugs and Workarounds
bullet How to Control Page Numbering in a Word Document by Bill Coan, MVP. Using Fields for Page Numbering - Much more Control - and see also...
bullet How to insert the filename and path on the last page of a document, such that it will be updated automatically if the filename or path changes by Bill Coan, MVP.
bullet Keyboard shortcuts for manipulating fields and dates by Charles Kenyon
bullet Customizing Your Table of Contents with Switches by Suzanne S. Barnhill, MVP.
bulletThe {=} Field - Formula Field - Documentation on MS site 
bullet MacroButton Fields - not just for macros anymore! by Charles Kenyon
bullet Using MacroButton Fields by Graham Mayor, Jonathan West and Hak-lok NG
bullet Using {MacroButton} fields to insert information from the Outlook Address Book into documents such as letters by Graham Mayor, MVP
bullet Using Addin Fields by Hak-lok NG - this is virtually the only documentation available for these fields which accept / hold data which is not visible to the user (like document variables) - they can only be set or read using VBA
bullet StyleRef Field Tutorial - two-page download
bullet Using Styles in Letterhead and in Headers and Footers by Charles Kenyon - StyleRef field
bullet Letterhead Textboxes and Styles Tutorial - two page download demonstrating StyleRef and Author fields, among other things
bullet IncludeText Field Tutorial - Ten-page, three-document tutorial with IncludeText links demonstrating switches, interaction of styles, and use of hidden Page field for continuous page numbering of separate documents. Also demonstrates the weird behavior of headers / footers in source document.
bulletMacro to replicate contents of a CheckBox formfield in place of { REF } field - download the Checkboxes Tutorial
bullet Conditional Drop-Down Form Fields
bulletMacro to update all fields in a document, including those in headers and footers - or just all REF fields if you want - See also Greg Maxey's page on Field Macros listed below
bullet Useful StyleRef Field Tricks by Suzanne S. Barnhill, MVP
bullet Understanding the Advance Field by Allen Wyatt
bullet Field Macros - Greg Maxey's page on using vba to manipulate fields
bullet Formatting Mailmerge Fields - Office for Mere Mortals
bullet Relative Addressing of Paths in Fields (for outside files) - thread on Woody's watch on vba programming to achieve this
bulletChapter 16 of Microsoft Word 2010 In Depth by Faithe Wempen
bulletWord Fields - WordTips page of tips Ribbon Interface - Menu Interface - More than 100 articles
bullet Field Codes: Not Just for Geeks
bullet Field Code Reference - Word 2010 (Virtually all of the information here applies to earlier versions of Word as well.)

 
bulletMicrosoft Knowledge Base: 
bulletUsing the {ASK} Field Inside an {IF} Field - Article Q211664
bulletWhich Fields get Automatically Updated - and When - Article 89953
bulletWhich fields are updated when you open, repaginate, or print document - Article 211629
bulletHow to Create Two Page Numbering Schemes In One Document - Article 212313
bullet {ASK} fields and {FILLIN} fields - double prompts. You are asked twice to answer each field. See the Microsoft Knowledge Base Articles Q238978 and Q164547.
bulletWhat happens to field results when you save as text? Article Q211688.
bulletHow to Create an Automated Form with Fill-In Fields. Articles Q238275 and Q142213
bulletQ95133 WD: How to Create a Checked/Blank Check Box Using FILLIN Fields
 
bulletDate Fields - Calculated - Advanced
bulletChris Woodman: http://www.chriswoodman.co.uk/Delayed%20Dates.htm
bulletHow do I insert a date? Why does it (not) change when I open the document?
bulletCalculated Dates: http://www.addbalance.com/word/datefields2.htm (also below)
bullet Calculated Dates - zip file - a Word document by Macropod - examples of very complex calculated date fields that you can modify to suit your purposes - alternative download site on Graham Mayor's site
bulletHow to Add Pop-Up Lists to Any Word Document So You Can Click Your Way Through Changes in Seconds (or how to use the AutoTextList field) by Bill Coan, MVP.
bulletCheckboxes Tutorial - Add-In - Examines different kinds of checkboxes, allows putting active checkboxes in a document / template that is not protected for forms.
bulletSample Forms
bulletPublic Defender Payment Voucher - Summary cover sheet with five time sheets. Extensive use of tables, cross-references, calculated fields. (zip format)
bulletPublic Defender Transcript Request Form (based on printed form - wild layout of fields using tables, some use of bookmarks, use of exit macros to control tab order. (zip format)
bulletSample Templates using fields
bulletASK fields sample form Two-Page tutorial uses ASK field in conjunction with bookmarks and REF fields. Latest version also has FILLIN fields for comparison.
bulletUserForm sample Tutorial with open code. UserForm, bookmarks & cross-references
bulletGender toolbar Add-In - use of calculated fields based on document property. Fields are inserted using AutoText from a menu.
bulletCheckBox Global Template - Active Checkbox fields that work without a protected form. Open VBA code.
bulletLetterhead System - uses bookmarks and date fields
bullet Letterhead Textboxes and Styles Tutorial - two-page template download that demonstrates use of 
bullettextboxes in headers and footers to reserve space for preprinted letterhead
bulletStyles that are based on each other and use the style for following paragraph feature
bulletUse of the StyleRef field to insert information from the body of a letter into the continuation page headers automatically
bulletInsertion of a date automatically that will not change when you open the document at a later date (but can be changed manually)
bulletSee How can I get a different header - footer on the second page in Microsoft Word? for more on how this tutorial works.
bullet Legal Toolbars - date fields stored as AutoText entries available on drop-down menu
 
bullet

Word Help topics:

bullet

Dictionary-style headers

bullet

Fields

 

Click to return to table of contents page of Legal Users' Guide to Microsoft Word.Click to go to Microsoft Word new users frequently asked questions site in a new browser window.
(this guide table of contents) ------- (MS Word New Users FAQ)

 

"A field in a Word document is simply a placeholder that contains the instructions for what should go here rather than the text itself."
 
John McGhie 
"Word's Numbering Explained"

Fields Overview

You will find fields to be one of your basic tools in preparing document templates that will automatically update themselves to reflect information you want to be in the document. Combining them with AutoText will give you a handy toolbox that you can use in all of your documents. 

This chapter is not a total review of fields, but rather a look at the ones that people working in a legal environment (or similar workplace) have found useful.

How to type fields in Word

The { } field delimiters can not be typed using the braces characters on the keyboard. They are special Word characters that have to be inserted as a pair using Ctrl+F9, or Insert => Field... or Insert => Cross Reference... or some other special field insertion command. If you are using Ctrl+F9 you can either press Ctrl+F9 first and then type your field or type the field code first, select it, and press Ctrl+F9. Once you are done with the field, press F9 to update the field and display the result.

I call these delimiters { } "braces" in this and other pages. Microsoft calls them brackets, but to me brackets have right angles and look like [ ] so I'll go on calling delimiters braces.

How to toggle the Display of Field Codes in Word

Sometimes (rarely) you want to see the field codes rather than the text generated by a field. This can be set in your Word Options, but the simple way is to use the keyboard shortcut of Alt+F9. This switches all fields in the Word session to display or hide field codes. Note, this is a Word option toggle and remains set for all Word documents and future Word sessions until toggled back.

When you have field codes displayed in a document, they will print rather than the field code results. This is great for debugging, but not what you usually want. You can also choose to print them as a print option.

The XE (Index Entry), TC (Table of Contents Entry) and TA (Table of Authorities Entry) fields are exceptions. Those fields are displayed when Hidden text is displayed and are not affected  one way or the other by the toggling of Field Code Display. Complex Documents - Microsoft Word Intermediate User's Guide - Table of Contents - Table of Authorities - Cross-References

How to copy a field from a newsgroup or email message into Word:

If you are using a typed field display from a newsgroup or email message first make sure that the field isn't broken up by any line breaks or paragraph breaks. (Lines that are wrapped automatically by Word are fine but turn on Show All to make sure there are no special characters at the end of the line.) Select the text inside a matched pair of braces and press Ctrl+F9. Word will insert its field delimiters around the text. Delete the typed braces.

For instance, with the field:

{ = { REF "Number1" } * { REF "Number2" } }

first select

REF "Number1"

and press Ctrl+F9, then select

REF "Number2"

and press Ctrl+F9, then delete all of the typed braces and select everything from the = sign to the end of the second field and press Ctrl+F9 again.

Then press F9 to update the field and display the result.

If you press Alt+F9 (view field codes) you'll see something that looks very much like what you started with except the field delimiters look like bold braces and the field will probably be shaded. Press Alt+F9 again to go back to viewing the field result.

You can also use the macro found on Graham Mayor's site to convert fields to/from plain text.

For more on fields, follow the links on the Word Web Resources Page. For a table of shortcut keys dealing with fields, see below.

Using the Insert Field... dialog box to insert fields

(so far, just the heading)

Field Categories (per Microsoft)

bulletDate and Time
bulletDocument Automation
bulletDocument Information
bulletEquations and Formulas [sic]
bulletIndex and Tables
bulletLinks and References
bulletNumbering
bulletUser Information

The DATE field and its variations.

The easy way (but probably wrong way for what you want) to put a date in your document is Insert => Date or Alt+Shift+D.

If you don't check "Update Automatically" it is the same as typing the date yourself. If you do check "Update Automatically" it will update when you print (if you have the setting under printer options as "Update Fields" which is the default). You can manually force an update by putting your insertion point in the date and pressing the [ F9] key.

If you want to put a date in a template that updates to the current date when a document is created based on the template, or want to change the format or do other things with the date field, you want to use Insert => Field => Date and Time instead. Using the options here, you can either pick a format or type your own characters (called a picture) for the format. The options for the type of date include:

bullet{ DATE } - The date you are looking at the document. Always today (although it may not show on screen as today until you update the field).
bullet{ CREATEDATE } - The date the document was created (or saved using Save As).
bullet{ PRINTDATE } - The date the document was last printed.
bullet{ SAVEDATE } - The date the document was last saved.

The above are the field codes that will be inserted for you using Insert => Field => Date and Time without using any options. A "\*MERGEFORMAT" switch is automatically inserted if you check "preserve field format" and means leave formatted the same way the field is formatted. Generally, you do not want to check this box or add this switch. If you want one of these formatting switches, you probably want "\*CHARFORMAT" instead.  This switch formats the field result however the first non-blank character within the field is formatted.

If you choose options, they can include the following "pictures:"

 Picture

 Displayed Date

 \@MMMM d, yyyy

 August 1, 2000

 \@MMM dd, yyyy

 Aug 01, 2000

 \@MM/dd/yy

 08/01/00

\@dddd, MMMM d

 Tuesday, August 1

 \@ddd, MMM. d, yyyy

Tue., Aug. 1, 2000

 \@MM/dd/yy hh:mm:ss am/pm

 08/01/00 10:36:12 PM

example: { CREATEDATE \@ "MMM dd, yyyy" }

The word "picture" in the above table indicates a guide to Word on how you want your field to display and print. (Normally called a "mask" in other programming but Microsoft decided to call this a picture for its own reasons.) If you don't like the pictures you are offered, pick the one that is closest to what you want and then modify it in the Insert Field dialog box (or in the codes themselves using Toggle Field Codes). For more on "pictures" and formatting dates see: Fields Switches.

For information on calculated date fields and a toolbar button that creates such fields, see: http://www.addbalance.com/word/datefields2.htm

Remember that fields in headers and footers don't get updated quite as predictably. They work fine with CREATEDATE but can have the same problem as page numbers (see that topic) with DATE.

 

 

The Function and Shortcut Keys that manipulate fields

Windows Keys

What

Macintosh Keys
F9 Update/Refresh Selected Field F9
Shift+F9 Display/Hide Field Codes (selected field) * Shift+F9
Alt+F9 Display/Hide All Field Codes (all fields in document) ** Opt+F9
Ctrl+F9 Create Empty Field 
(Insert { }Braces)
Cmd+F9
Ctrl+Shift+F9
or
Ctrl+6
Unlink Selected Field (delete all field coding and replace with field result) - turn field into text Cmd+Shift+F9
F11 Go to (Select) Next Field F11
Shift+F11 Go to (Select) Previous Field Shift+F11
Ctrl+F11
or
Ctrl+3
Lock Field (prevent manual or automatic update) Cmd+F11
or
Cmd+3
Ctrl+Shift+F11
or
Ctrl+4
Unlock Field (allow updating) Cmd+Shift+F11
or
Cmd+4
Alt+I, F Insert Field (Dialog Box
(Alt+I followed by F)
Opt+I,F
Alt+Shift+D Insert Date Field *** Ctrl+Shift+D

* It is possible to have fields inside of fields (nested fields). If this is the case, the Shift+F9 Toggle will not show all the field codes, only the outermost layer. To see all the field codes, use Alt+F9 instead.

** Alt+F9 is the same as checking / unchecking Field Codes in Tools => Options => View. Unlike a field code toggled using Shift+F9, if you update a field while all field codes are being displayed, the new field result will still be hidden and you will see the field codes.

*** Probably not the field you want to insert, though.

 

Bookmarks and Cross References (from Complex Legal Documents)

Inserting Bookmarks

We have all used bookmarks at one time or another. We've dog-eared pages and even used sticky notes to mark where we have left off in a book. Word does the same thing in long documents. If you have bookmarked a paragraph or heading in your document, the next time you open the document you can use Goto to move to your bookmarked location.

This is especially handy when you find that there are parts of your document that are constantly being updated. You can use bookmarks to jump in and out of those problem spots quickly.

Note CK Note: Bookmarks are also the best way to have text inserted in one place reflected elsewhere in the document -- or even in another document! You do this by insertion of a cross-reference to the text of the bookmark. Cindy Meister refers to this as the second mode of bookmarks -- not just holding a place in a document but holding content in a document.
Practice: Insert a Bookmark
  1. Select any text on the page.
  2. From the Insert menu, choose Bookmark (or press CTRL+SHIFT+F5).

The Bookmark dialog for inserting bookmarks

(In Word 2007 and later the control to insert a Bookmark is on the Insert Tab of the Ribbon. The Ctrl+Shift+F5 shortcut continues to work.)

  1. Create a name for your bookmark in the Bookmark name field (you cannot start a Bookmark name with a number, and Word won't allow spaces within the name).
  2. Click Add. (Notice that Word has added this new bookmark to the bookmark list.)
  3. Click Close.
Navigating With Bookmarks

Now that you have marked your document with bookmarks, let's go over the easy ways to move throughout your document using them.

Practice: Find your Bookmarks
  1. Press F5 on your keyboard. The Find and Replace dialog box appears, with the Go To tab activated. In the Go to what list, find Bookmark.
  2. One of your bookmarks will fill the Enter bookmark name field. If this is not the bookmark you are looking for, click the drop-down arrow and select the bookmark that you want to find. Click Go To, and Word will take you to the bookmarked location.

    The Find and Replace dialog with the Go To tab selected, to find a bookmark

  3. You can go to the next bookmark by pressing F5 again and selecting the new bookmark name and clicking Go To.
Warning CK Warning: Bookmarks are fragile creatures and easily deleted when you are editing bookmarked text! For instance, if you follow the directions above to go to a bookmark, you will have the bookmark (as well as the bookmarked text) selected. If you make changes without adjusting this, you will delete the bookmark and any references to that bookmark (see below) will be invalid. 

When you are working with bookmarked text, keep your view options set to view bookmarks and your Undo key handy! When I am working with bookmarked text and want to preserve the bookmark, I will put my insertion point (cursor) inside of the bookmarked text - just after the first letter of that text. I will then insert the changes that I want to make and delete the surplus text by hand using the delete or backspace keys. 

This fragility exists in all versions of Word to date (2013).

For more on bookmarks see: Word Bookmarks by Cindy Meister

 

Working with Cross-references

To refer the reader to another part of the document, you can insert a cross-reference.

Note CK Note: Cross-reference fields can refer to bookmarked text. Further, instead of simply providing a link or a page number for referenced text, cross-reference fields can reproduce that text. This is Word's primary way of repeating variable text in a document.
Practice: Insert a Cross-reference
  1. Create a new document and type the following:
    Introduction
    Overview
    Unsolicited Proposals
    Solicited Proposals
    General
    The Proposal
  1. Click anywhere within the first line, Introduction.
  2. Click the Style drop-down arrow and apply Heading 1.
  3. Select Overview, and apply Heading 2.
  4. Select Unsolicited Proposals, Solicited Proposals and General. Apply Heading 3.
  5. Select The Proposal and apply Heading 2 style, and after deselecting the text press Enter twice.
  6. Your cursor is where the cross-reference is to be inserted.
  7. Type something to the effect of, "For more information, see".
  8. From the Insert menu, choose Cross-reference.

The Cross Reference dialog

  1. In the Reference type drop-down list, select what reference type is appropriate for your cross-reference, for this example use Heading as the reference type. You can also use a numbered item, bookmark, footnotes, endnotes, equations, figures or tables.

The Cross Reference dialog with a Heading selected

In the Cross-reference dialog box, you also have a choice of how you want the reference to look. You could reference the heading text as shown above, or Page #, Heading #, Heading # (no context), Heading # (full context), and above/below.

  1. Select Unsolicited Proposals and click Insert. The dialog box remains open for any other cross-references that you may want to add. If you do not want to add more cross-references, just click Cancel.
  2. As you can see, your cross-reference has been marked. If you click "Unsolicited Proposals," Word takes you to the heading.

Jumping to a cross reference in a document

Updating Cross-references

If you have changed your text that is a cross-referenced passage in your document and the cross-reference has not updated, you need to update the field. You can alternate-click on the field code and select Update Field, or select the field code and press F9. This updates the field to reflect recent changes.

Note CK Note: If the material in a cross-reference displays a field in the original text, you may want to include the following "switch" in your cross-reference field code: \!  This is the "lock result" switch and prevents a field like { DATE } in your original bookmarked text from updating in your cross-reference when you update the cross-reference field, unless it has been updated at the source. (Complex, I know, but you usually will want to use this switch.)

 

ASK Fields

Ask fields are very close to WordPerfect's prompt fields. When you create a new document that contains an ASK field, you are asked a question (written by the person who created the template) and given a dialog box in which you can answer the question. Your answer is then inserted into a zero-width bookmark and can be accessed by using a {REF} field anywhere in the document (or even in another document with an INCLUDETEXT field.)

This is still in its infancy. See my download page for examples of ASK fields.

MacroButton Fields - not just for macros anymore!

Syntax 

{ MacroButton MacroName DisplayText }

MacroButton - the field command

MacroName - name of macro being called - or "NoMacro"

DisplayText - text that acts as the "button" for the macro and is displayed in your document. Note that there are no quotation marks used in this field. DisplayText can be any text you want but will not wrap to a new line. There are limits on length. Instead of the DisplayText you can insert an inline picture or icon to act as a visual button for your macro. See below, though for images. The text in a MacroButton field prompt cannot be longer than a single line between the left and right indents for the paragraph. You can shrink the font size of the prompt text to fit more words on that single line.

Behavior

Clicking on a MacroButton field will select the field. Double-clicking on one will activate a macro if there is a macro designated. You can change this behavior to make the macro activate on a single click as well.

MacroButton Fields as Prompts

You can use the first behavior (selecting the field) to make simple click-and-type prompts. If you look at many of the templates that come from Microsoft with Word, you will find places that say something like "[Click here and type]." If you click at that spot, the whole prompt is selected and anything you type replaces it. Often, this is exactly what you want for a simple prompt. What you are seeing is a simple implementation of the "MacroButton" field.

To insert a MacroButton field like this in your document type it then make it a field.

As is the case with all fields, you cannot simply type the field braces { }. You either have to use Word's Insert => Field or press Ctrl+F9 and type the field contents. To get: { MacroButton NoMacro DisplayText } you could simply type "MacroButton NoMacro DisplayText" and select it. Then press the Ctrl+F9 key combination to make it a field. Pressing F9 will update it to the field display of DisplayText. You must create or edit the field manually to get colors or other formatting in your prompt text that will disappear when the user actually uses it and types.

Inserting a MacroButton field like this in your document using the Field insertion dialog is a bit more involved:

(Word 97-2003) Insert => Field ... 

(Word 2007-2013) Insert => Quick Parts => Field ...

Where it says Field: type "MacroButton NoMacro prompt." The "MacroButton" is the name of the field. "NoMacro" is the name used by the field for the macro to be called - in this special case, none. The "prompt" is whatever prompt text you want. This can be "[Click here and type]" or the text that will usually be just fine but which the user might want to change. "NoMacro" is used as a convention to indicate that there is no macro being used. Note that if there was an available macro with the name "nomacro" that macro would be run by this field. Any name that does not indicate an available macro will give the same result, that is, the entire field will be selected when clicked on (as always happens with a MacroButton) but since no macro can be found, the result is selected text. If you want to format your prompt text, you need to do that by revealing the field code and editing. To me, typing the field and then using Ctrl+F9 to insert the braces is much easier.

As is the case with other fields, the F11 key will take you to the next field, selecting that field. When you use macrobutton fields as prompts, you may want to put an instruction in your documents to use F11 to go to the next field. I do this putting the instruction in blue or red text and a different font in a textbox formatted to float in front of text. The textbox is formatted to have no lines and no fill. The text in the textbox is formatted as hidden so it should not print. I have this textbox as an AutoText entry in my developer's template so that I can insert it easily when I prepare a new template.

Below is an example of how a Macrobutton Prompt appears in a document. (Screenshot) The field code for this prompt is:

{ MacroButton NoMacro This is a macrobutton prompt! When you click on it, all is selected. }

The first paragraph shows the prompt as displayed on the page. The second shows the prompt after it has been clicked on before typing; the third shows that the prompt colors do not show up in the text after the user types.

You can download a free Add-In that gives you the dialog box below to add a MacroButton prompt to your document where you want with a choice of colors for the prompt text.

Picture of custom dialog box from Add-In. Click to go to download page.

Dialog box from Add-In

MacroButton Fields to Run Macros

Instead of simply being a prompt for typing, this MacroButton field will run a macro if double-clicked. (This can be altered to a single click using VBA.) Instead of NoMacro, simply type the name of the macro. When inserting the field, you can click on the Options button and you will be given a list of available macros (possibly quite a long list) from which to select.

Where it says "Macros defined in active document" a more accurate caption would be "Macros available to active document." This list also includes all of Word's built-in commands, many of which are not found on the menus.

Note that the MacroButton field is selected when it is clicked or double-clicked. You may want to have your macro collapse the selection at some point so that your MacroButton field won't be inadvertently deleted. The language for this is:

Selection.Collapse 
'Unselects the current selection and places 
'insertion point at beginning of selection.

Note also that a macro button prompt will print as ordinary text. (It is the field result). To avoid it being printed, you may want to put it in a no-border text box formatted as hidden text (Format => Font). Because of this, it is often easier to use a custom toolbar with a button on that toolbar. The toolbar will not print.

MacroButton Fields can be used in Protected Forms and will be active even in a protected portion of the document. They are often used in such forms as a replacement for hyperlinks (since regular hyperlinks are inactive in the protected portion of a form).

A simple example of macrobuttons can be found in the CheckBox template. This template/tutorial combines the powers of macros, autotext, and the macrobutton field.

MacroButton Fields where the Macro responds to the contents of the field (uses them as an argument or variable for the macro)

It is possible to use one macro that responds to the contents of the field to change what the macro does. Doing this with Private or AddIn fields incorporated in MacroButton fields is discussed in the MacroButtons page on the MVP FAQ site. The same technique can be used with just the display text of the MacroButton field.

The macro is:

Sub TestMacro2()
Dim MyString As String
    'Ignore first 24 characters of the macrobutton field -
    '   the words 'MacroButton TestMacro2', and the spaces
    MyString = Mid$(Selection.Fields(1).Code, 24)
    MsgBox MyString
End Sub

The field is:

{ MacroButton TestMacro2 [Click Here] }

This can be used to construct a list of templates in the Workgroup Templates folder as macrobuttons. When you double-click (or single-click as shown below) on the macrobutton, the macro creates a new document based on the named template. A single macro decides which template to open based on the template listed in the macrobutton field.

That is, the following fields both call the same macro:

{ Macrobutton TeemplateListLoad Releases\Release - blank}

{ Macrobutton TeemplateListLoad Log}

The macro uses the display information to decide which template to use. The macro is:

Sub TemplateListLoad()
'   Based on ideas from http://word.mvps.org/FAQs/TblsFldsFms/UsingMacroButton.htm
'   Macro written by Charles Kyle Kenyon
'   24 October 2002
'
    Dim sTemplateName As String
    Dim sTemplatesPath As String
    '
    '   Get workgroup templates path
    '
    sTemplatesPath = Options.DefaultFilePath(wdWorkgroupTemplatesPath) & "\"
    '
    '   Parse template name from Macrobutton field.
    '   (The selection is the entire field.)
    On Error GoTo ErrorHandler
    sTemplateName = Mid$(Selection.Fields(1).Code, 31) & ".dot"
    '   Use to create a new document based on the template
    Documents.Add Template:=sTemplatesPath & sTemplateName
    Selection.Collapse
    Exit Sub
    '
End Sub

Making MacroButtons respond to a single click

To me, double-clicking on a button is counter-intuitive. To make a macrobutton respond to a single click the following VBA code has to be active:

Options.ButtonFieldClicks = 1

This has to be run before the user tries to click on the button. It can be in an AutoOpen or AutoNew macro in the template which contains the macrobutton or in an AutoExec macro in a global template. (Explaining these gets beyond the scope of this article; see Template Basics for more.)

Using MacroButtons to function as hyperlinks in protected forms.

In a document that has been "protected" as a form in Word, hyperlink fields don't work, but macrobutton fields do work. You can use a macrobutton for a hyperlink to an external document or web page (and even format it to look like a hyperlink) in a protected document. It is more work than merely inserting a hyperlink, though. (You can also use a macrobutton to link to an internal bookmark with reservations, see end of this section.)

  1. With your document not protected for forms, record a macro that opens the document to which you want to link. Save the macro in your document (not in Normal.dot) when you record it.
  2. Use the Macro Editor (Alt+F11) to edit your macro. At the end of the macro (just before "End Sub") add the following line.
      Selection.Collapse
  3. Where you want your hyperlink Press Ctrl+F9 to insert your field codes and type "MacroButton MyMacro displaytext." where "MyMacro" is the name of your macro and "displaytext" is what you want the hyperlink to show in your document. (See Syntax above)
  4. Press F9 to update your field. It should show your displaytext.
  5. Select your field and press Ctrl+Shift+S to get into the styles drop-down.
  6. Type "hyperlink" for the style name and press enter.

When you protect your document your pseudo-hyperlink should work fine. Remember to set the ButtonFieldClicks to 1. Also, the mouse pointer will not change to a little hand when passing over your pseudo-hyperlink - but we can't have everything, can we?

If you would like some pre-written code for your hyperlink macrobutton, you can download HyperJmp.zip from the Visual Basic MVP site.

For alternative coding, take a look at Using Hyperlinks in Protected Forms on the MVP site. They show how to use a single macro for all your hyperlinks in the document.

When the target of the link is within the protected form it doesn't work quite so well. It will jump to the field addressed by your bookmark if your bookmark is for a formfield, otherwise to the field following your bookmark. If there is no field following your non-field bookmark, it jumps to the first field in the document. Note that fields inserted with the Forms toolbar automatically have a bookmark assigned. (You can change that bookmark in the field's properties.) Thanks to Marcy T. for bringing this problem to my attention.

For more on protected forms, follow the links in my web resources page, especially those to Dian Chapman's excellent series of articles.

Example of MacroButton Field Use in Multiple Ways - The Microsoft Fax Transmittal Template from Word 97

Note the checked box by "For Review." Here is the same template after toggling display of Field Codes (Alt+F9). The prompts for user input are MacroButton fields not associated with any macro. A dummy name of "NoMacro" is inserted but the purpose of the field is to display the prompt. The checkboxes in the form are MacroButton fields, not Form Checkboxes or Content Controls! Both of these use the property of MacroButton fields to select the entire field when clicked on. The display text for the checkbox fields is the unchecked or checked box.

If there were an active macro named NoMacro (or nomacro) these MacroButton fields would call that macro!

The name of the macro called by the (unchecked) Urgent checkbox is "CheckIt." The one called by the (checked) For Review checkbox is "UncheckIt." Look again at the form with the field codes not showing. All you see is the display text - the checked and unchecked boxes.

See Checkbox Add-In for samples.

Different behavior with images for text in .doc vs .docx formatted documents

An image does not work well as a prompt in document (templates) formatted as .docx or .docm (.dotx or .dotm). These are the document and template formats for the Ribbon versions of Word (2007+). See this post on the Microsoft Answers forum. The image is selected, not the field. If the image is deleted by the user and the user types, that typing becomes the prompt for the field. Clicking or double-clicking on the field will not run a macro.

If the same document is saved in .doc or .dot format, the macrobutton field will act as specified. The screenshot below is from a document in .docx format when the MacroButton Field has been clicked on.

Here is a screen shot of the same thing, except the same document has been saved in .doc format:

In the .doc format, clicking on the macrobutton selects the field (and a double-click will run an associated macro). If the user types anything, the image is deleted, the field is deleted, leaving only the typing. When in .docx format, the image is selected in the field. No macro is run. If the image is deleted by the user and the user types, what the user types becomes the new MacroButton field prompt!

Additional references on MacroButton fields

bulletHow to create a template that makes it easy for users to “fill in the blanks”, without doing any programming
bulletEnable a user to double-click text in a document to change its value
bulletRun a macro when a user double-clicks a button in the document
bulletMacroButton field reference on MS site
bulletCheckbox AddIn - a tutorial on the use of MacroButton fields together with AutoText and Macros to insert checkboxes into non-protected documents. 
bulletUsing MacroButton Fields by Graham Mayor, Jonathan West and Hak-lok NG
bulletUsing {MacroButton} fields to insert information from the Outlook Address Book into documents such as letters by Graham Mayor, MVP
bullet Instant Envelopes Using the MacroButton Field and VBA by Dian Chapman, MVP

Click to return to table of contents page of Legal Users' Guide to Microsoft Word.Click to go to Microsoft Word new users frequently asked questions site in a new browser window.
(this guide table of contents) ----- (MS Word New Users FAQ)

Search Usersguide to Microsoft Word using Google

 

 

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 in the Header/Footer instead of multiple sections with different Headers / Footers

You can use the StyleRef field with Word's built-in Heading Styles to change the content of the Header / Footer to reflect local document contents. Thus the Header/Footer can change to reflect headings and other content.

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 download 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.

Formula (Calculation) Fields - Conditional Fields

A formula field is one that does some kind of calculation and shows you the result. It starts with an equals sign:

{ = 1 + 3 - 1 }

will show a result of 3. Calculations are performed in much the same way as in algebraic expressions. 

Field Result
{ = 1 + 3 - 1 }

3

{ = 1 + 3 - 1 * 4 } 0
{ = (1 + 3 - 1) * 4 } 12

See the help files for more information on the rules for what gets calculated first.

When used in online (protected) forms, make sure that the source of the calculation has the property checked to "calculate on exit." Here is an example which takes the Number from one formfield, multiplied by the price from another. Formfields can be given names which Word treats as bookmarks.

{ = Number * Price }

Formula fields can be nested and can use results of other fields as parts. They can be used as a part of conditional fields.

Conditional Fields - The IF field

The structure of an {IF} field is: {IF expression "truetext" "falsetext"}. Expression means a statement that will be either True or False. {IF 1=1 "One does equal one!" "This one doesn't equal that one!"} Trivial? How about: {IF {REF "Gender"} = "Male" "He" "She"}. (Download the Gender Toolbar template to see how this works in real documents.) You may have noticed that we have one field inside of another field here! Yes, fields can use other fields for parts of their structure.

An If field can be used to display/hide a table or pull in the contents of a completely different document depending on the results of the condition.

If Field Practice: A footer entry that only appears on the last page?

How would you put the document name and path in the footer of your document to appear only on the last page of the document?

You can insert an automatic page number anywhere in a document (especially in a header or footer) by pressing Alt+Shift+P. This gives you a {PAGE} field that displays as the correct number. Doing this is probably preferable to using the Menu command (Word 2003 and earlier) which inserts a page number in a frame. Frames are not in the main document and it makes editing difficult. Likewise, you can use the Insert Page Number choices under the Insert tab in Word 2007 and later but that overwrites existing headers and footers!

The first thought is "I have put a condition on this. I need a conditional Field! - an {IF} field!  In this case, there are two page numbering fields that can be used and compared. 

{PAGE} = {NUMPAGES}

The first field is the field to display the current page number. The second is to display the total number of pages in the document. Normally, these are used in "Page {PAGE} of {NUMPAGES}." The only time this statement will be true is if this is the last page in the document. We have our expression.

We want the document's name with its path. The field for a document's name can be found in the Document Information category: the {NAME} field. An optional switch for this field is "\p" so what we want is the field {NAME \p}. We can add something else to our {IF} field to print on other pages if we want; how about the Page X of Y noted above? So, our conditional field looks like:

{IF {PAGE} = {NUMPAGES} "{NAME \p}" "Page {PAGE} of {NUMPAGES}" }

On the last page, this will print the full document name. In a four-page document, on page three, it will print "Page 3 of 4."

Question for the curious:

What will the following field print if placed in a footer? When?

{IF {PAGE} < {NUMPAGES} "Page {PAGE} of {NUMPAGES}" "{NAME \p}" }

Click here for answer. Further exercise: What fields would you use if you only wanted something to appear in the header or footer of the third page of the document, the next-to last page of the document? See How to Control the Page Numbering in a Document. See that page as well if you have numbering restart at some point in your document.

 

Nested {IF} Fields

One {IF} can be used inside of another one to give logical branches and twists.

{IF {PAGE} = 1 "This is the first page." "{IF {PAGE} < {NUMPAGES} "Page {PAGE} of {NUMPAGES}" "{NAME \p}" }" }

This is called "nesting." The nested IF field is used if the first expression is false. If you think this is complex, wait until we tackle date fields!

When used in online (protected) forms, make sure that the source of the calculation has the property checked to "calculate on exit."

bullet IF Field Reference on Microsoft Office site - Word 97-2003
bullet IF Field Reference on Microsoft Office site - Word 2007-2013
bullet Examples of IF Fields - Microsoft Office site - Word 97-2013
bulletGender toolbar Add-In - makes extensive use of IF fields to test for gender document property

 

Date Fields using IF

Here is an example of a calculated date field written in response to the request: 

I need to create a fiscal year field in Word 97 that accomplishes in Word what the following statement accomplished in English:

If today's month and day are less than or equal to June 30, display the current year, else display current year + 1.

{ IF { DATE \@ "MM" } < 07 { DATE \@ "yyyy" } { = { DATE \@ "yyyy" }+1 \# "0000" } }

If today were January 31, 2001, the following expression using that field for the year would display: "June 30, 2001" where the year is the field and the rest of the date is regular typed text. If today were July 1, 2001, the same expression would display as  "June 30, 2002." This might be used in a phrase such as "the end of this fiscal year, June 30, 2001."

This uses the test IF field together with date fields and an equation field to display the result if the result is a different year. The formats for the dates are set using date pictures. However, if the result is a different (calculated) year, then you need to use a number picture. In this case, I started out with a two-digit year and was using the picture 00. With a four-digit year, the picture becomes irrelevant.

The field shown above handles the year part of the date. It would have to be combined with an additional DATE field to get the month and day. Note that the field above might work better with a CREATEDATE field instead of the DATE field. With the CREATEDATE field and the additional field for the month and day, we get:

{ CREATEDATE \@ "MMMM d"}, { IF { CREATEDATE \@ "MM" } < 07 { CREATEDATE \@ "yyyy" } { = { CREATEDATE \@ "yyyy" }+1 \# "0000" } }

 

Here's a head-spinner! Dizzy! This little head-spinner emoticon borrowed from Woody's Word Lounge. Click to go there. The following is an example of a field that gives you the date two weeks from the day a document is created, in regular written English format:

Creation date: July 9, 2001 - desired field result = July 23, 2001
Creation date: July 23, 2001 - desired field result = August 6, 2001
Creation date: December 20, 2001 - desired field result = January 3, 2002
Creation date: February 27, 2003 - desired field result = March 12, 2003
Creation date: February 27, 2004 - desired field date result = March 11, 2004

{ QUOTE "{ SET " Delay" "14" }
{
  SET "DaysInMonth" { IF { CreateDate \@ "MM" } <> 2
{
  = ROUND(30.575*
{ CreateDate \@ "MM" },0)-
ROUND(30.575*
{ = { CreateDate \@ "MM" } -1 },0) }
{
  IF {  = MOD( { CreateDate \@"yy" } , 4 ) } > 0 "28" "29" } } }
{
SET "NextMonth" {  IF {  CreateDate \@ "MM" } = 12 "1/97" 
"
{ = {  CreateDate \@ "MM" } + 1 }/97 } }
{
  IF {   = {  REF "Delay" } + { CreateDate \@ "dd" } } <= { REF"DaysInMonth" }
{
CreateDate \@ "MMMM { = {  REF "Delay" } + { CreateDate \@ "dd" } }, yyyy"}{ QUOTE { NextMonth \@ "MMMM"
} 
{
 =
{ REF "Delay" } + { CreateDate \@ "dd" } - { REF"DaysInMonth" } }
{
IF { CreateDate \@ "MM" } <> 12 { CreateDate \@ "yyyy" }
{
CreateDate \@ "{ = 1 + { CreateDate \@ "yyyy" } \# "xxxx" }" } } } }" }

The colors in the sample field above represent my attempt to match field delimiters and show nesting of fields. I hope it helps. Those fields shown in green contain no nested fields but may contain references to bookmark values set by other fields. Line breaks have been added for clarity and should not be a part of the actual field.

You can download a document containing the above field to play with if you like. I wouldn't advise trying to reproduce it by hand! This particular field is a tweaked result of a very nice Add-In by Chris Woodman which seems to be no longer available online. For more on date calculations see Calculated Dates which includes links to other pages on date field calculations as well as some discussion of VBA methods of handling date calculations.

 

Combining Fields with AutoText

One of the most efficient ways to insert fields into your documents and templates is with AutoText. An example of a template that does this is the Gender Toolbar template that can be downloaded from my downloads page.  It has fairly complex IF fields that can be inserted from a menu in a custom toolbar.

 

Formatting Field results (what shows on screen and prints)

How your field looks and prints depends on (1) the formatting applied to the paragraph (direct or styles), (2) the formatting applied to the characters (direct or styles), and (3) any field formatting switches. In this section, we'll look at the switches that you might want to use. Remember, display your field codes by pressing Alt+F9.

Those applied by default:

 

Capitalization (case) switches:

Switch

Result

\* caps Capitalize Each Word
\* firstcap Capitalize the first word only
\* lower lowercase text
\* upper UPPERCASE TEXT

Dates: reviewed above

Numbers:

Instruction switches (as distinguished from picture switches)

Switch

 

Result & Explanation

\ * cardtext Cardinal number Converts numbers in the result to cardinal text form. To control case, add another format switch that specifies capitalization. For example, {= sum(A1:B2) \ * cardtext} gives a result such as "seven hundred ninety." The field {= sum(A1:B2) \ * cardtext \ * caps} gives a result such as "Seven Hundred Ninety." Can be used in a Page field to spell out page numbers. {PAGE \* cardtext \* caps}
\ * dollartext Check format Converts numbers in the result to cardinal text, inserts "and" at the decimal place, and displays the first two decimals (rounded) as arabic numerators over 100. For example, {=9.20 + 5.35 \ * dollartext} gives the result "Fourteen and 55/100."
\ * ordinal Ordinal number Converts numbers in the result to arabic ordinal form. For example, {DATE \ @ "d" \ * ordinal} gives a result such as "30th."
\ * ordtext Ordinal text Converts numbers in the result to ordinal text form. To control case, add another format switch that specifies capitalization. For example, {DATE \ @ "d" \ * ordtext \* caps} gives a result such as "Fourteenth." The field {DATE \ @ "d" \ * ordtext \ * upper} gives a result such as "FOURTEENTH."
\ * alphabetic   Converts the result to alphabetic characters. The result has the case of the first character of "alphabetic." For example, {SEQ appendix \ * Alphabetic} gives a result such as "B" instead of "2."
\ * arabic (default) Converts numbers in the result to arabic cardinal form. For example, {PAGE \ * arabic} gives a result such as "31." When the setting in the Number Format setting in the Page Number Format dialog box (Header-Footer View, Page Numbers Format Button, View menu) is other than arabic, the "\ * arabic" switch overrides the dialog box setting.
\* hex hexidecimal Converts numbers in the result to hexidecimal numbers. For example, {QUOTE "458" \ * hex} gives the result "1CA."
\ * roman Roman numeral Converts numbers in the result to roman numerals. The result has the case of the first character of "roman." For example, {SEQ chapter \ * Roman} gives a result such as "XI." The field {SEQ chapter \ * roman} gives a result such as "xi." Useful in page numbering for front matter.
 

Picture switches

Syntax

\ # "instructions"

Remarks

Specifies how to display the numeric result of a field. This switch is called a "picture" switch because you specify a pictorial representation for the field result. For example, the field {= SUM(ABOVE) \ # "$#,##0.00"} displays a currency result such as "$4,455.70" because of the "\ # "$#,##0.00"" Numeric Picture switch. If the result of a field is not a number, this switch has no effect.

Note

Quotation marks are not required around simple numeric pictures that do not include spaces (for example, {mayreturns \ # $#,##0.00}). For more complicated numeric pictures and those that include spaces, you must enclose the entire numeric picture in quotation marks (for example, {= mayreturns+junereturns \ # "$#,##0.00 'increase';$#,##0.00 'decrease'"}). When you add a Numeric Picture switch to a field using the Add To Field button in the Field Options dialog box (Field command, Insert menu), Word automatically encloses the numeric picture in quotation marks.

Use any combination of the following instructions to build your numeric picture.

 

Switch

 

Result & Explanation

\# "00.00" 0 (zero) Required digit placeholder. A zero in the numeric picture indicates that you want a digit to appear in that place in the result. If the result does not include a digit corresponding to a zero's position, a zero is displayed. For example, {= 4 + 5 \ # "00.00"} displays the result "09.00."
\# "##.##" # (number sign) Optional digit placeholder. Number signs in the numeric picture indicate that you want a digit to appear in that place in the result only if the result calls for it. If the result does not include a digit corresponding to a number sign's position, a space is displayed. For example, {= 9 + 6 \ # "$###"} displays the result "$ 15."
\# "x" x (round) Truncating digit placeholder. Drops any digits to the left of the placeholder, and rounds up when placed to the right of the decimal point. For example, the field {= 3/4 \ # ".x"} uses a truncating digit placeholder to the right of the decimal point that rounds the result up to one decimal place. The calculation yields .75, which is rounded to .8 in the field result.
  decimal point Indicates where to place the decimal point. For example, {= SUM(ABOVE) \ # "$###.00"} displays a result with two digits to the right of the decimal point. The character you use as a decimal point must match the decimal character in your system setting. Typically, this is a period (.) in the United States and a comma (,) for many other countries. Use the International option in Control Panel to set the decimal character for your system.
  thousands separator Separates series of three digits to display large numbers clearly. For example, {= NetProfit \ # "$#,###,###"} displays a result such as "$2,456,800." The character must match the thousands separator character in your system setting. Typically, this is a comma (,) in the United States and a period (.) for many other countries. Use the International option in Control Panel to set the thousands separator character for your system.
\# "-" - (minus sign) Adds a minus sign if the result is negative, or a space if the result is positive or zero. For example, {= 10 - 90 \ # "-##"} displays the result "-80."
\# "+" + (plus sign) Adds a plus sign if the result is positive, a minus sign (-) if the result is negative, or a space if the result is zero. For example, {= 100 - 90 \ # "+##"} displays the result "+10."
  positive; negative Specifies different number formats for positive and negative results. For example, {= sales93 \ # "$#,##0.00;-$#,##0.00"} displays a positive result for the bookmark "sales93" in regular character formatting-such as "$1,245.65"-and a negative result in bold character formatting with a minus sign-such as "-$ 345.56."
  positive; negative; zero Specifies different number formats for positive results, negative results, and a zero result. For example, {= sales93 \ # "$#,##0.00;($ #,##0.00);$0"} displays a positive result for the bookmark "sales93" in a format such as "$1,245.65," a negative result in parentheses, such as "($  345.56)," and a zero result as "$0."
\# "'literal text'" 'text' (literal text) Inserts literal text in the result. Enclose the text in apostrophes. For example, {= {price}*8.1% \ # "$##0.00 '= sales tax' "} includes the text "= sales tax" in the field result.
  `sequence` (sequence value) Includes the value of a sequence such as the current chapter number. Enclose the sequence identifier in accents grave (`). The result is displayed in arabic format. For example, {CREATEDATE \ @ "M/d/yy 'is the creation date of Chapter' `chapter`"} gives a result such as "7/22/93 is the creation date of Chapter 2."
  character Includes any other character - space, hyphen (-), asterisk (*), and so forth - in a date-time picture. For example, the field {DATE \ @ "HH:mm MMM-d, yy"} adds a colon and hyphen to the field result. Note that the character must be something other than the picture characters already reserved by the system, both those above and those set forth in the date formatting pictures.

 

Word Help topics:

Word 2000

bullet

Dictionary-style headers

bullet

Fields

Word 97

bullet

Fields

bullet

Dictionary-style headers

 

 

 
Tip Tip  

The following is from the Chapter on Numbering:

Create Sequence Fields for Interrogatories and More

A Sequence field tracks differently numbered lists within a document. Combining Sequence fields and AutoText entries give you a fast and easy way to insert Interrogatories, Requests for Production, and Requests for Admission.

Practice: Use Sequence Fields

  1. Type INTERROGATORY NO. followed by a space.
  2. Press CTRL+F9 to insert field characters.
  3. Type SEQ Rog within the field characters.

 

Note Note  The "Rog" in this example is the name of the Interrogatory numbering scheme. This name will keep this numbering scheme unique from any other schemes that may be running in the document. See Tip below for more information.

  1. Press F9 to update the field. A number "1" should appear.
  2. Select INTERROGATORY NO. 1, and press ALT+F3 to create a new AutoText entry.
  3. Type rog for the AutoText entry name, and click OK.
  4. Type Request for ANSWER followed by a space.
  5. Press CTRL+F9 to insert field characters.
  6. Type SEQ Ans within the field characters.
  7. Select ANSWER 1, and press ALT+F3 to create a new AutoText entry.
  8. Type Ans for the AutoText entry name, and click OK.
  9. Type Ans and press F3. The next sequential number for an Answer appears.
  10. Press ENTER and type rog and press F3. The next sequential Interrogatory appears.

To use the AutoText entry, simply type rog and press F3.

 

Tip Tip  Follow the same steps (above) to create Request for Production or Request for Admissions. The only difference would be in Step 3, you would change the "rog" to "rpf" or "rfa". This will keep unique numbering schemes running in the same document. Therefore, you could have an Interrogatory No.1 as well as Request for Production No.1. Keep in mind that if you cut, copy or paste sequence codes, you'll need to select them and press F9 to update the field codes. They do not update automatically.
Using vba (macros -- Visual Basic for Applications) to insert fields in documents

First, generally you will want to simply create a field and perhaps edit it in the InterFace. If you need to repeat that field often, you will save it as an AutoText Entry (Building Block) for easy reuse. There may be times, though, when you want to be able to place a field into a document using a macro.

Here are some sample macros, mostly based on the work of Paul Edstein and Greg Maxey. The first is to insert a MacroButton field to use as a prompt.

(More to be done here. See their posts in this forum thread in the meantime.)

Troubleshooting Fields — Issues To Watch Out For

  1. Insertion of field braces {} using the keyboard instead of the Ctrl+F9 key combination { }. With show field codes on, you won't see the difference when you are typing until you try to turn the field codes off. They may look the same to you and me but to Word they are very different! You can't enter fields manually using the braces on the keyboard. If you did this by mistake, cut your text, delete the typed braces, insert new braces using Ctrl+F9, and paste your text.
  2. Fields in headers/footers. You cannot use a document variable field in a header/footer. It will crash Word.
  3. Page numbering fields. Word doesn't really have pages, it just cuts things up into pages as it prints. There are times when it will start printing before it has finished cutting and the page numbers (especially the NUMPAGES) will be wrong.
  4. Fields not updating. They may be locked. Most fields don't update when you open, edit, or close a document, but rather when you print it.
  5. ASK fields and FILLIN fields - double prompts. You are asked twice to answer each field. See the Microsoft Knowledge Base Articles Q238978 and Q164547.
  6. What happens to field results when you save as text? See the Microsoft Knowledge Base Article Q211688.
  7. When discussing field codes in the forums or an email it can be helpful to actually see the code. When you copy a field code from Word and paste elsewhere (as in a forum) you simply get the field result.

    Related online thread: Convert field codes to text for posting | Windows Secrets Lounge.

    Here is a macro from Paul Edstein (macropod). I've been using it since 2004 when I want to look at or share a field code. (Truly sharing a complex field code requires sending a document with the code in it, though.)

    Sub FieldCodeToString()
    '
    ' From Paul Edstein (macropod)
    ' Found at http://www.gmayor.com/export_field.htm
    ' Posted to the newsgroup on 15 April 2004 by macropod
    ' Converts a Word field code to a string (in the clipboard)
    '
    Dim Fieldstring As String
    Dim NewString As String
    Dim CurrChar As String
    Dim CurrSetting As Boolean
    Dim fcDisplay As Object
    Dim MyData As DataObject
    Dim X As Long
    '
    NewString = ""
    Set fcDisplay = ActiveWindow.View
    Application.ScreenUpdating = False
    CurrSetting = fcDisplay.ShowFieldCodes
    '
    If CurrSetting <> True Then _
    fcDisplay.ShowFieldCodes = True
    Fieldstring = Selection.Text
    '
    For X = 1 To Len(Fieldstring)
    CurrChar = Mid(Fieldstring, X, 1)
    Select Case CurrChar
    Case Chr(19)
    CurrChar = "{"
    Case Chr(21)
    CurrChar = "}"
    Case Else
    End Select
    NewString = NewString + CurrChar
    Next X
    '
    Set MyData = New DataObject
    MyData.SetText NewString
    MyData.PutInClipboard
    fcDisplay.ShowFieldCodes = CurrSetting
    End Sub


    This code and the reverse (string to code) can be found on Graham Mayor's site with directions on how to use them.
     

 

 

 

Answers to question on footer field:

{IF {PAGE} < {NUMPAGES} "Page {PAGE} of {NUMPAGES}" "{NAME \p}" }

On the last page, this will print the full document name. In a four-page document, on page three, it will print "Page 3 of 4." (That's right, it prints the same thing under the same circumstances as did our other field! The order of the truetext and falsetext have been reversed because if "{PAGE} < {NUMPAGES}" is true then "{PAGE} = {NUMPAGES}" must be false.

To put "truetext" only on the third page of the document the field would look like:

{IF {PAGE} = 3 "truetext" }

To put "truetext" only on the next-to-the-last page the field could look like:

{IF {PAGE} = { = {NUMPAGES} - 1 }" "truetext" }

 

 

 

 

There is no corresponding Chapter on the Microsoft website.

Hit Counter page views since 14 April 2004