本示例更新活动文档的目录中的各项目页码。

For i = 1 To ActiveDocument.TablesOfContents.Count
    ActiveDocument.TablesOfContents(i).UpdatePageNumbers
Next