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.
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!
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 MoreWord includes a couple of built-in tools that rely upon the use of heading styles in your document. These tools include ...
Discover MoreIf your document is any length at all, adding a table of contents is a nice touch. This tip demonstrates how easy it is ...
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