UpdatePageNumbers Method

Microsoft Word Visual Basic

UpdatePageNumbers Method

       

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

expression.UpdatePageNumbers

expression   Required. An expression that returns a TableOfContents or TableOfFigures object.

Example

This example updates all tables of figures in Sales.doc.

Dim tofLoop As TableOfFigures

For Each tofLoop In Documents("Sales.doc").TablesOfFigures
    tofLoop.UpdatePageNumbers
Next tofLoop

This example inserts a page break at the insertion point and then updates the page numbers for the first table of contents in the active document.

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