Thread: [Solved] Update TOC
View Single Post
 
Old 08-01-2012, 09:58 PM
ubns ubns is offline Windows 7 32bit Office 2010 32bit
Competent Performer
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default

Thanks Paul,

so just creating this module in normal.dotm will work, is that correct.

Code:
Private Sub fileprint()
Application.ScreenUpdating = False
Dim TOC As TableOfContents    ' Table of Contents Object
Dim TOA As TableOfAuthorities ' Table of Authorities Object
Dim TOF As TableOfFigures     ' Table of Figures Object
Dim Rng As Range              ' Word Range Object
With ActiveDocument
  ' Update fields in each Story.
  ' Note that this may trigger the updating of ASK & FILLIN fields
  For Each Rng In .StoryRanges
    .Fields.Update
  Next
  ' The following routines are necessary because the foregoing updates only page numbers
  ' in TOCs, TOAs and TOFs - field updating doesn't update TOC, TOA or TOF contents.
  ' Loop through Tables Of Contents and update
  For Each TOC In .TablesOfContents
    TOC.Update
  Next
  ' Loop through Tables Of Authorities and update
  For Each TOA In .TablesOfAuthorities
    TOA.Update
  Next
  ' Loop through Tables Of Figures and update
  For Each TOF In .TablesOfFigures
    TOF.Update
  Next
End With
Application.ScreenUpdating = True
End Sub

Last edited by macropod; 08-09-2012 at 04:42 PM. Reason: Added code tags & formatting
Reply With Quote