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:
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.
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!
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 MoreIt is easy to generate a table of contents for a document, and that TOC can contain page number references for each ...
Discover MoreThe TOC (Table of Contents) is generated by a field. This field may be updated in a macro using a single command line.
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)
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.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments