Word: Macro to fix Track Changes/Cross References issues and accept all field changesOctober 16, 2009
When all Track Changes have not been accepted, you may not be able to insert a cross-reference to a table or figure caption correctly. Either you see multiple instances of the caption listed in the Cross Reference dialog box, OR you don’t see the caption at all, OR you see an incorrect table/figure number for the caption (e.g. you see Table 5.1 instead of Table 1.1).
This is a known issue with Word since at least Word 2000 (see the list of resources at the end of this post).
You’d think that accepting all changes would be sufficient. And it is. But accepting all changes is not appropriate where you have a document that MUST keep Track Changes on, such as one that has to go through a regulatory compliance process through all its revisions. I have been working on these types of documents. In Word 2003, it was never really an issue — double-upped cross-references were an annoyance more than anything, and we never noticed any that were missing. But as soon as my client started using Word 2007, we came across serious issues with existing table and figure captions not being listed in the Cross Reference dialog.
A little testing showed that it was related to Track Changes being on and the acceptance of all changes in the document. Armed with that knowledge, I headed off to trusty Google to try to find a solution — a solution that allowed cross-reference and caption fields (and lists of tables and figures) to be updated without affecting other parts of the document.
Macropod (clever name!), a Microsoft Word MVP, had posted a macro that solved the problem (http://www.pcreview.co.uk/forums/thread-31716892.php). It worked great, but it dropped me into the footer and into Draft view at the end of the document when it was finished. So I posted my request to the Microsoft Word Programming Discussion Group, and the ever-helpful Macropod tweaked his/her original macro to get me what I wanted, which was to return to where I was when I ran the the macro.
Here’s Macropod’s revised macro:
Sub AcceptTrackedFields() Dim oRng As Range ' All Range objects - includes ranges in the body, Headers , Footers & Shapes Dim Fld As Field ' Field Object Dim oView As Variant ' The original document view Dim SelRng As Range ' The original selection ' Turn Off Screen Updating Application.ScreenUpdating = False With ActiveDocument oView = ActiveWindow.View.Type Set SelRng = Selection.Range ' Loop through all range objects and accept tracked changes on fields For Each oRng In .StoryRanges Do For Each Fld In oRng.Fields Fld.Select Selection.Range.Revisions.AcceptAll Next Set oRng = oRng.NextStoryRange Loop Until oRng Is Nothing Next End With With ActiveWindow If .View.SplitSpecial = wdPaneNone Then .ActivePane.View.Type = wdPrintView Else .View.Type = wdPrintView End If .View.SeekView = wdSeekMainDocument .View.Type = oView SelRng.Select End With ' Restore Screen Updating Application.ScreenUpdating = True End Sub
Thanks heaps, Macropod! The generosity of the Microsoft MVPs and community is humbling.
- How and where to store this macro so that you can use it with all your Word documents: https://cybertext.wordpress.com/2009/10/18/word-separate-out-macros-and-attach-them-to-all-documents/
Some websites that discuss this issue
- http://www.tech-archive.net/Archive/Word/microsoft.public.word.docmanagement/2008-12/msg02350.html (or http://bit.ly/zY0fh)
- http://www.tech-archive.net/Archive/Word/microsoft.public.word.docmanagement/2008-12/msg02346.html (or http://bit.ly/3RsWxT)
- http://www.shaunakelly.com/word/trackchanges/HowTrackChangesWorks.html (question and answer near the bottom of this page)
- http://www.pcreview.co.uk/forums/thread-3715892.php (macro solution)
- http://support.microsoft.com/kb/252619 (shows that it was an issue back in Word 2000!!)
- http://www.mcse.ms/archive/index.php/t-2809819.html (option to lock fields??)
- More on locking the fields: http://wordribbon.tips.net/Pages/T009921_Stopping_Automatic_Changes_from_Being_Tracked.html
- List of tables/figures won’t update: https://cybertext.wordpress.com/2012/03/28/word-sometimes-a-list-of-tablesfigures-just-wont-update/
[Links last checked October 2009]