Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-05-2019, 11:07 AM
d4okeefe d4okeefe is offline Broken TOC Windows 10 Broken TOC Office 2016
Advanced Beginner
Broken TOC
 
Join Date: Apr 2013
Posts: 77
d4okeefe is on a distinguished road
Default 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>
...
Any one have an idea?


Thanks in advance.
Reply With Quote
  #2  
Old 08-05-2019, 08:41 PM
gmayor's Avatar
gmayor gmayor is offline Broken TOC Windows 10 Broken TOC Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,103
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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
Reply With Quote
Reply



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
Broken TOC Need to create a template that can't be broken! MSOfficeNOOB Word 1 01-17-2018 03:43 PM
Broken TOC Mutlilevel list is... broken RavingMad Word 7 04-18-2017 09:17 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:23 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft