View Single Post
 
Old 07-16-2025, 06:33 AM
Charles Kenyon Charles Kenyon is offline Windows 11 Office 2021
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,536
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

I prefer to have the TOC, Table of Figures and Table of Authorities styles Auto Update.
Here is the macro based on the one for proofing language.
Code:
Sub NormalStylesAutoUpdateOff()
    '   Written 16 July 2025
    '   Charles Kenyon
    '   Intended to set all styles in Normal template (except those used in TOC, TOF, or TOA) to not automatitically update
    '   Use right after opening Word
    '
    ' https://www.msofficeforums.com/word/...-document.html
    '
    Application.ScreenUpdating = False
    Application.NormalTemplate.OpenAsDocument
    Dim aStyle As Style
    On Error Resume Next    ' Some styles have no language attribute and will give an error
    For Each aStyle In ActiveDocument.Styles
        Select Case aStyle.NameLocal
            Case "TOC 1", "TOC 2", "TOC 3", "TOC 4", "TOC 5", "TOC 6", "TOC 7", "TOC 8", "TOC 9", _
                 "Table of Figures", "Table of Authorities"
                Let aStyle.AutomaticallyUpdate = True
            Case Else
                Let aStyle.AutomaticallyUpdate = False
        End Select
        Let aStyle.NoProofing = False   ' also turn on spelling and grammar checking
    Next aStyle
    Let ActiveDocument.UpdateStylesOnOpen = False    ' For information on using this line, see:
    '       http://www.shaunakelly.com/word/shar...matchange.html
    ActiveDocument.Close SaveChanges:=True
    Let Application.ScreenUpdating = True
    Application.ScreenRefresh
    MsgBox title:="All done!", prompt:="All non-TOC styles in the Normal template set to not automatically update."
    On Error GoTo -1
End Sub
Reply With Quote