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

Editing While Spell-Checking

When you run a spell-check on a document, you may end up seeing other things that need to be edited. Never fear; you can ...

Discover More

Opening an HTML Page in a Macro

Excel allows you to open HTML pages within the program, which is great for some purposes. What if you want to open a ...

Discover More

Searching by Columns, by Default

Do you often want to search through a worksheet by column rather than by row? Excel defaults to searching by row, of ...

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)

Locking Lines in a TOC

Want to "lock down" the lines in a TOC so that you cannot add new paragraph marks in the middle of one? You may not be ...

Discover More

Headings in Tables Not Showing in TOC

Word includes a couple of built-in tools that rely upon the use of heading styles in your document. These tools include ...

Discover More

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
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 eight more than 4?

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.