I have created a TOC manually in my document (Office 365) so I can apply custom styling etc and are trying to update it once I have finished manipulating my document.
In an ideal world I don't wan to manually created the TOC as I'd like to keep the current styling and just update the table. I've tried two different methods of updating the TOC (all before saving the document)
- Code: Select all
document.UpdateTableOfContents()
This does nothing and leaves the table as is.
The next option was to find the table of contents within the document then call the following code
- Code: Select all
document.UpdateTableOfContents(toc)
This actually removes the TOC altogether leaving nothing.
Can you help with with the correct code to update an existing table of contents.
For reference, to do this in word you would Right Click the TOC, select Update Field then choose Update Entire Table.
Thanks