Reputation: 1039
In MS Word, table of contents (TOC) can be converted to normal text manually using Ctrl-Shift-F9.
Is there a way to convert TOC to normal text programatically?
Word VBA has TableOfContents class but, it seems, the class doesn't provide any method that can be used for such conversion.
Upvotes: 0
Views: 9066
Reputation: 1039
Well, it is not that hard. Here is the solution:
For Each nextTOC In ActiveDocument.TablesOfContents
nextTOC.Range.Fields.Unlink
Next
In the snippet above, the code loops through all the tables of contents in the active document, gets Fields property of each TOC's Range and calls Unlink on it.
Upvotes: 2