You can update a TOC using a macro by utilizing the Tables Of Contents collection.
Each item in the collection represents a single TOC in the document.
(In most documents the collection will consist of only a single item.) To update the entire TOC, you use this format of the command: Whenever you use commands like these in a macro, it is a good idea to make sure that there is actually a TOC in the document before you try to do any updating.
(Microsoft Word is the most popular word processing software in the world.) This tip (301) applies to Microsoft Word 97, 2000, 2002, and 2003.
You can find a version of this tip for the ribbon interface of Word (Word 2007 and later) here: Updating an Entire TOC from a Macro. Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2013.
Spend more time working and less time trying to figure it all out!
Please Note: This article is written for users of the following Microsoft Word versions: 97, 2000, 2002, and 2003.
If you are using a later version (Word 2007 or later), this tip may not work for you.
For a version of this tip written specifically for later versions of Word, click here: Updating a Field in a Text Box.
Jay has a situation where he has a document property field inserted in a text box in a document.
Using Ctrl+A and then pressing F9 should update all the property document fields in the document, but this one field is not updated by Jay?
For a version of this tip written specifically for later versions of Word, click here: Updating an Entire TOC from a Macro.
If you have a document that contains a table of contents (TOC), and you update the fields in the entire document, Word asks if you want to update the entire table or just the page numbers in the table.
This occurs because TOCs are implemented through the use of a field, and when you update all fields you are telling Word you also want to update the field underlying the TOC.