Page related procedures in class TableOfContents (Word VBA)

This page presents procedures from class TableOfContents related to the theme Page: IncludePageNumbers, RightAlignPageNumbers and UpdatePageNumbers

IncludePageNumbers

True if page numbers are included in the table of contents.

If ActiveDocument.TablesOfContents.Count >= 1 Then 
 With ActiveDocument.TablesOfContents(1) 
 .IncludePageNumbers = True 
 .RightAlignPageNumbers = True 
 End With 
End If

RightAlignPageNumbers

True if page numbers are aligned with the right margin in a table of contents.

If ActiveDocument.TablesOfContents.Count >= 1 Then 
 With ActiveDocument.TablesOfContents(1) 
 .IncludePageNumbers = True 
 .RightAlignPageNumbers = True 
 End With 
End If

UpdatePageNumbers

Updates the page numbers for items in the specified table of contents.

Selection.Collapse Direction:=wdCollapseStart 
Selection.InsertBreak Type:=wdPageBreak 
ActiveDocument.TablesOfContents(1).UpdatePageNumbers