How do I update all fields in a Word document?
Problem
I want a way of updating all fields in a Word 2013 document. (If it works in other versions, all the better; I originally had this problem with Word 2007, and nothing seems to have changed since then.) This includes cross-references, page numbers, tables of contents, indexes, headers, etc. If it can be updated by pressing F9, I want it updated. (In theory updating fields can cause other fields to need updating, e.g. a longer table of contents changes some page numbers in the main text. Taking care of the common cases is good enough for me. In fact, it's ok if I have to run the macro two or three times before it stabilizes. I just want to have a single macro that finds everything.) My attempt so far doesn't update fields in text boxes inside figures. How do I update them, and what else have I missed? EDIT: Combining the answer given with what I already had gives a macro that seems to update everything (with a known defect).
Error Output
'' Update all the fields, indexes, etc. in the specified document.
Sub UpdateAllFieldsIn(doc As Document)
'' Update tables. We do this first so that they contain all necessary
'' entries and so extend to their final number of pages.
Dim toc As TableOfContents
For Each toc In doc.Tab…Unverified for your environment
Select your OS to check compatibility.
1 Fix
Fix for: How do I update all fields in a Word document?
I just do Ctrl+A - to select everything - and then F9 to update the lot. Although, this misses headers and footers, but they update when you print/print-preview IIRC. ###Update I've found the following macro. On a quick test it updated tables of contents, fields within paragraphs, fields within the header and footer, and fields within a floating text box figure. Hopefully that covers everything that you need, if not please indicate what is still failing to update. Source: http://www.gmayor.com/…
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix