Updating an Entire Table of Contents

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


Whenever Jim chooses to update a Table of Contents, he is presented with a dialog box that asks if he wants to update pages only or the entire table. Jim always wants the entire table updated, so he wonders if there is a way to bypass the dialog box entirely or, failing that, have the "entire table" option be the default.

There is no way to bypass the dialog box, and it doesn't appear that the dialog is even accessible via a macro. You can, however, use a macro to update all of the Tables of Contents in your document. Here is an example of such a macro, and it requires surprisingly few lines of code:

Sub UpdateAllTOCs()
    Dim t As TableOfContents

    For Each t In ActiveDocument.TablesOfContents
        t.Update
    Next t
End Sub

The macro steps through each of the TOCs in your document (the one that is currently active) and updates them. The .Update method updates the entire table, not just the page numbers. If, for some reason, you want the macro to update just page numbers, then you would use the .UpdatePageNumbers method instead.

One tangential benefit of the macro is that you don't need to be anywhere near the Tables of Contents in your document in order to update them. Run the macro, and it steps through each of them regardless of where they are in the document, without changing your position within the same document.

To make the macro more accessible, of course, you could assign it to a shortcut key or you could add it to your Quick Access Toolbar.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (10274) 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

Maximum Length Limit for a Macro

Make your macros too long, and Excel may just refuse to run them at all. This tip explains what the limit is for macros, ...

Discover More

Changing Characters on Keyboard Keys

Want to assign some fancy characters to keyboard keys for characters you seldom use? There are a couple of ways you can ...

Discover More

Changing What Follows a Footnote Number

Word makes it easy to insert footnotes in your document. It doesn't, however, make it easy to change the format in which ...

Discover More

Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2013. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word 2013 Step by Step today!

More WordTips (ribbon)

Creating a Table of Contents from Heading Levels

If your document is any length at all, adding a table of contents is a nice touch. This tip demonstrates how easy it is ...

Discover More

Page Ranges in a TOC

It is easy to generate a table of contents for a document, and that TOC can contain page number references for each ...

Discover More

Updating an Entire TOC from a Macro

The TOC (Table of Contents) is generated by a field. This field may be updated in a macro using a single command line.

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 7 + 0?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


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.