April 2006 Newsletter News from Home and Abroad
Word's Best Kept Secret; the RD Field Code
by Cathy Clarke STC UK, Senior Member
Word documents can get big, especially when they are full of images. Eventually, the only sensible thing to do is to split them into multiple documents. "But what about the Table of Contents", someone mutters. "I don't want to build a TOC by hand!" But is it really such a problem? Well, not if you know about Word's best kept secret, the RD field code.

Word's field codes have been around since 1992, but few people know about them and even less people use them. A quick search on Google showed there is little information on the web about field codes in general and almost nothing about the RD code.

The RD field code lets you build a Table of Contents across multiple documents. The following is an example:
Contents Example

Please note: This is NOT a discussion about Master documents. Referenced documents are quite different!! Files are totally independent of each other, and when building a TOC, Word opens one document at a time, stores the headings in each and finally creates the TOC. You can use the same method to build an index or table of figures.

Simple Example

The Documents

Let's start with a very simple example; 2 chapters and a separate document containing the TOC.

Example Page

We'll call them ReferencedDoc1.doc and ReferencedDoc2.doc and TOCdoc.doc. All documents reside in the same folder.

Each document uses styles to assign Heading 1, Heading 2, Heading 3 and Body Text. The page numbering in the second document has been restarted to follow on from the first document. In our example the second document starts at page 22.

Setting up the Table of Contents

Set up the Table of Contents in TOCdoc.doc. Make sure that all the documents are in the same folder.

Now, insert a Table of Contents as follows:

  1. Choose Reference from the Insert menu.
  2. Choose Index and Tables from the Reference menu
  3. Click OK.

Because there are no headings in the Contents document, you see the following error message.

Error: No TOC Entries found!

To retrieve the headings from the other chapters, you need to add RD field codes that point to the other files. Do this as follows:

  1. Press Ctrl + F9 to open a pair of Field Code BracesField Code Braces.

  2. Now, add the RD field code details for the first document. These are as follows:

    RD Codes

  3. Repeat the process for the second document.

    Error message plus_RD Codes

  4. Finally, select all the text on the page and then press F9 to update fields. The error message disappears and is replaced by the headings from the other documents.

    Generated TOC

Note: Once set up, the RD field codes become hidden text. Select Field Codes and Hidden text in the Options dialog box to display them. Pressing Alt F9 hides / displays field codes.

Getting a More Sophisticated TOC Layout

The example above has a very simple layout. The TOC field code has switches that let you create more sophisticated layouts. By using some of Word's other field codes and switches you can:

Once you know which field codes to look for, check out Word's Online Help. This lists all the available switches and gives examples. Look for TOC, Index, RD, Seq and mergeformat.

Things to Watch Out For

When working with Referenced Documents there are several things that you need to watch.

Limitations

There are some limitations to the Referenced Document methodology. The biggest problem is that you cannot cross-reference between chapters.