Creating a Table of Contents Involving Multiple Documents

by Allen Wyatt
(last updated April 16, 2021)


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:

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

If you want some additional information on using this third approach, check out these resources:

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, and 2013.

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


Resolving Revisions

You've reviewed the changes that were made to your workbook using the Highlight Changes tool. Now you need to remove the ...

Discover More

Hiding a Huge Number of Rows

Need to hide a large number of rows? It's easy to do if you combine a few keyboard shortcuts. Here are several techniques ...

Discover More

Macros in Two Workbooks Interfere with Each Other

Having macros in multiple open workbooks can sometimes produce unexpected or undesired results. If your macros are ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More WordTips (ribbon)

Jumping Back to the TOC

Word allows you to create a table of contents that provides hyperlinks to headings within your document. It doesn't make ...

Discover More

Using Dot Leaders in Special Tables

Adding dot leaders before page numbers in a table of contents or table of authorities can make the finished table look ...

Discover More

Paragraph Numbers instead of Page Numbers in a TOC

Word is great at creating a simple, straightforward table of contents. If you want a more non-traditional TOC, however, ...

Discover More

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

View most recent newsletter.


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 9 + 4?

2020-10-30 12:41:40

Roy Wall

Like Rachel Kyle, below, I have had trouble getting, e.g., clicked page-numbers in my TOC document to go to the corresponding place in a document mentioned using an RD field in the TOC document.

2020-05-07 12:50:45

Rachel Kyte

I have a large number of documents with individual TOCs as well as a single document which contains a TOC of all the other documents which I created using the RD command. I have now created separate PDFs of all the files and combined them into a complete document. In the final PDF the hyperlinks in the TOCs all work except for the master one created using the RD command. Is this even possible? Any help would be very much appreciated. Thank you.

2019-12-12 17:26:50

peter roth

Allen - mousetrax website is now about K9 pillows rather than Word ...

2019-10-16 14:13:32


Is it possible to have the TOC link to the specific section by clicking on the page number/section name? Like you can when your TOC and sections are within the same document. Better yet, I would prefer that when I PDF the sections together that the TOC would have the CTRL + CLICK option.

2019-10-07 16:07:32


How do you input the filename in step #7 of approach 3? I've tried the location path on my machine, just the filename (with and without .docx included) and the TOC can't find the file I'm referencing in the field code.

2017-07-24 19:46:41


Is the RD field version limited to 7 documents? I can't seem to add anything after Chapter 7.

2017-02-17 02:59:22


Can this also be done with a table of authorities (putting it in a separate document than the one containing the marked cites)?

2016-12-29 13:56:55

Gordon M

Just as an update, I had the same bug in Word 2013, but eventually it was fixed in a Word update (I think some time in 2014 or 2015). Word 2016 also does not have this issue.

Using the RD method, is there any way to create a PDF file of the final document (with all the documents included), and for that PDF to include hyperlinks from all the TOC entries to the correct locations in the PDF?

2015-10-03 04:45:15

Ken Endacott

The macro:
Sub MultipleFilesTOC()
Dim fl As String
Dim flNames() As String
Dim flCount As Long
Dim j As Long
Dim k As Long
Dim TOClevels As Long
Dim mydir As String
Dim aString As String
Dim projName As String
Dim fldType As Long

' ----- Delete any existing TOC and RD fields -----
j = ActiveDocument.Fields.Count
If j > 0 Then
For k = j To 1 Step -1
fldType = ActiveDocument.Fields(k).Type
If fldType = wdFieldTOC Or fldType = wdFieldRefDoc Then ActiveDocument.Fields(k).Delete
Next k
End If

' ----- set generic name to current file name -----
projName = ActiveDocument.Name
mydir = ActiveDocument.Path
TOClevels = 3

' ------ get list of files in directory ------
j = InStr(projName, ".")
aString = Left(projName, j - 1) & "*" & Mid(projName, j)
flCount = 0
ReDim flNames(0)
fl = Dir(mydir & "" & aString)
Do While fl <> ""
If UCase(fl) <> UCase(ActiveDocument.Name) Then
flCount = flCount + 1
ReDim Preserve flNames(flCount)
flNames(flCount) = fl
End If
fl = Dir()
If flCount = 0 Then
MsgBox "No files found"
Exit Sub
End If

' ----- sort file names -----
For j = 1 To UBound(flNames) - 1
For k = j + 1 To UBound(flNames)
If flNames(j) > flNames(k) Then
fl = flNames(j)
flNames(j) = flNames(k)
flNames(k) = fl
End If
Next k
Next j

' ----- Create TOC and RD fields -----
Selection.Fields.Add _
Range:=Selection.Range, Type:=wdFieldEmpty, PreserveFormatting:=False, _
Text:="TOC o " & Chr(34) & "1-" & Trim(Str(TOClevels)) & Chr(34) & " h z u"
For j = 1 To UBound(flNames)
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, PreserveFormatting:=False, _
Text:="RD " & Chr(34) & flNames(j) & Chr(34) & " f"
Next j
ActiveWindow.View.ShowFieldCodes = False
End Sub

2015-10-03 04:36:41

Ken Endacott

The fourth approach is to use a macro to generate the TOC and RD fields.

This following macro will create a Table of Contents from several documents having the same generic name. The TOC will be created in the current document after deleting any existing TOC and RD fields.

1. Give documents generic names for example MydocChapt01, MydocChapt02 etc. They must be in the same folder.
2. Adjust page numbering in the documents to give number spanning.
3. The front document should have the generic name in this case Mydoc. It may for example contain the title page and summary and can include heading paragraphs.
4. Set the variable TOClevels to give the number of levels in the TOC.
5. Position the cursor at the position where you want the TOC and run the macro


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.


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.