Creating a Table of Contents Involving Multiple Documents

Written by Allen Wyatt (last updated December 31, 2022)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021


2

Francis has multiple documents that, for the purposes of a Table of Contents, he needs to treat as a single document. He wonders if there is a way to create a Table of Contents that actually spans multiple documents.

There are actually three ways to go about this. I'll quickly describe two of the approaches and then spend a bit more time on the third.

The first approach is to simply create a new document and then copy the contents of each of your files into that new document, in the proper order. Let's say that you have a series of documents named Chap01, Chap02, Chap03, and on through Chap32. You would open each of these files, in turn, press Ctrl+A to select everything in the file, switch to the new document, and press Ctrl+V. As you do this, the new document gets larger and larger (of course), but when completed you can easily add a TOC to the beginning of the document.

Quite honestly, that approach is a lot of work, and it isn't terribly flexible. Every time you edit one of the documents you need to repeat the process to get a new TOC. So, I wouldn't recommend this particular approach.

The second approach is to use a master document and subdocuments. This is a feature built into Word that allows you to define a "container document" (the master document) and identify other documents that should be included in the container (the subdocuments). To create a master document, follow these steps:

  1. Create a brand-new document. Make sure that it uses the same template as the documents you want included in the TOC.
  2. Display the document in Outline view. (Display the View tab of the ribbon and click the Outline tool in the Views group.)
  3. Make sure the Outlining tab of the ribbon is displayed. (It should be displayed by default when you switch to Outline view.)
  4. In the Master Document group, click the Show Document tool. Word expands the tools in the Master Document group.
  5. Click the Insert tool, which is visible in the Master Document group. Word displays the Insert Subdocument dialog box. (This dialog box looks very similar to a standard Open dialog box.)
  6. Using the controls in the dialog box, locate and select the first document you want included in your TOC.
  7. Click Open. Word inserts the contents of the document, surrounded by section breaks.
  8. Repeat steps 5 through 7 for each of the other documents you want included.
  9. Insert and generate your TOC as you normally would.

If you decide to use this approach (creating a master document), understand that there are numerous horror stories related to their use. Many people consider master documents to be the fastest available way to Word document corruption. Because this is a possibility, you'll want to make sure you protect yourself by keeping backup copies of all of your original documents without those backups being part of a master document. You can find more information about corruption of master documents at this page on the Word MVP site:

https://wordmvp.com/FAQs/General/WhyMasterDocsCorrupt.htm

If you visit this MVP site, you'll find a link to a document by Steve Hudson that provides ten "rules" for using master documents and minimizing the chances of corruption. Most of the information in the document seems solid, albeit a bit dated. If you make it that far, you'll note that one of his rules is that the only thing that should be in a master document besides the links to the subdocuments is the TOC.

The third approach is to use field codes to combine the documents into a single document. This approach has the fewest number of drawbacks that I can find, so it is the one that I would suggest. Follow these steps:

  1. Create a brand-new document. Make sure that it uses the same template as the documents you want included in the TOC. You should make sure the insertion point is at the beginning of the document.
  2. Display the Insert tab of the ribbon.
  3. Click the Quick Parts tool in the Text group. Word displays some choices below the tool.
  4. Click Field. Word displays the Field dialog box.
  5. Choose Indexes and Tables from the Categories list (top left corner of the dialog box). (See Figure 1.)
  6. Figure 1. The Field dialog box.

  7. Select RD from the Field Names list. Word adjusts the appearance of the dialog box to include a Filename or URL box.
  8. In the Filename or URL box enter the name of the first file you want included in the TOC.
  9. Click OK. Word inserts the field into the document.
  10. Press Enter once.
  11. Repeat steps 2 through 9 for each of the other documents you want included.
  12. Insert and generate your TOC as you normally would.

Even though the RD field-code route is the safest approach, understand that if you are using Word 2013 you may experience a bug in the implementation of RD codes. (This was fixed in later versions of Word; it is only in Word 2013.) You'll know if you've encountered the bug if the generated page numbers for a file are all the same. You can apparently work around the bug by having all of the referenced files open in Word when you generate (or regenerate) the TOC. You could also, if desired, change all the RD field codes to INCLUDETEXT field codes, but if you choose to do so you will need to put a section break before and after each of the field codes.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (3318) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Determining the Length of a Non-Document Text File

If you use a macro to create and work with text files, you can find out the length of those files using a simple command. ...

Discover More

Checking All Cell Formatting in VBA

When your macro checks the formatting used for a cell, it needs to be careful that the type of formatting being checked ...

Discover More

Turning Off the Check for Repeated Words

If your work involves the usage of repeated words, you may be interested in configuring Word so it doesn't flag those ...

Discover More

Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!

More WordTips (ribbon)

Creating a Table of Contents from TOC Fields

If you inserted a bunch of TOC fields in your document, you can create your table of contents quite easily based on those ...

Discover More

Using Multiple Tables of Contents

Adding multiple tables of contents is a must for some types of document design. Here's a great overview of how you can ...

Discover More

Mixed Page Number Formats in a TOC

When you create a Table of Contents for a document that contains multiple sections, the page numbers in that TOC should ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is two more than 7?

2023-09-05 12:44:22

KK

I have 3 documents, the first one has content and I want to add the headings and TOCs for the other two documents. Following these steps, I keep ending up with the TOCs from document 2 and 3 being first and then at the end, the TOC for the current document when it should be first. I cannot figure out how to get the TOC from document 1 to show up first.


2023-02-15 17:27:36

Mike

Is there a way to include a reference document that has a wild card within it? More specifically, I utilize the date at the end of the document to track versions in yyyymmdd format. Is there a way to account for this? {RD "Chap01"& * & ".docx" \F} (and other variations) hasn't worked.


This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.

Videos
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.