Monday, 14 November 2016

Update Table of Contents Programmatically in Word

Assuming your document has only one Table of Contents, the following code will update it.

Sub UpdateTableOfContents()
 
    ActiveDocument.TablesOfContents(1).Update

End Sub

You can also assign a keyboard shortcut to this code using File->Options->Customize Ribbon->Keyboard Shortcuts (Customize).

No comments: