#1
|
|||
|
|||
Broken TOC
First off, I'm using Word 2016 for Desktop.
I have a document that contains a TOC. The TOC has been copied from a different document and is broken. When I click "Update Table", I get a message box that says "There's no table of contents to update. You can insert one from the References tab." However, I can see text of the original TOC. The TOC appears as formatted text, but it sits inside of a TOC Content Control. I can easily copy and paste that text using a cursor within Word. However, I want to get at that text using VBA. Can I use VBA to find the text, copy it from the broken TOC Control, and paste it into a paragraph without the Control? I have used the VBA Locals window to examine the document, but I can't figure it out. The "Count" property under TableOfContents is 0, as is the one for ContentControls. I looked at the XML and see that the section is introduced like this: HTML Code:
<w:sdt> <w:sdtPr> <w:rPr> <w:rFonts w:ascii="Century Schoolbook" w:eastAsia="Times New Roman" w:hAnsi="Century Schoolbook" w:cs="Times New Roman"/> <w:szCs w:val="24"/> </w:rPr> <w:id w:val="-1392880186"/> <w:docPartObj> <w:docPartGallery w:val="Table of Contents"/> <w:docPartUnique/> </w:docPartObj> </w:sdtPr> <w:sdtEndPr> <w:rPr> <w:b/> <w:bCs/> <w:noProof/> </w:rPr> </w:sdtEndPr> <w:sdtContent> ... Thanks in advance. |
#2
|
||||
|
||||
TOCs are inserted using fields. Press ALT+F9 to display the field. If it doesn't show something like { TOC \f \h \z \t "Title,1,Heading 1,2,Heading 2,3" } it is not a TOC but text. In which case insert a new TOC.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Header 3 is broken | musicmouse | Word | 1 | 05-21-2019 05:41 PM |
Forms Export as TXT Broken? | mcknigs | Word | 5 | 10-15-2018 12:14 PM |
Search is broken | martinlest | Outlook | 0 | 10-14-2018 01:18 PM |
Need to create a template that can't be broken! | MSOfficeNOOB | Word | 1 | 01-17-2018 03:43 PM |
Mutlilevel list is... broken | RavingMad | Word | 7 | 04-18-2017 09:17 PM |