Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-25-2024, 07:46 AM
KoolBreeze KoolBreeze is offline Delete a Line in a TOC Windows 11 Delete a Line in a TOC Office 2021
Novice
Delete a Line in a TOC
 
Join Date: Nov 2024
Posts: 8
KoolBreeze is on a distinguished road
Default

It’s fine if they reappear when the TOC is updated. This document is a bit unusual and will have very circulation/updates. It has multiple TOCs, a main heading style that is level 1, and multiple subheading styles that are level 2. Each of the subheading styles are unique to a single TOC. Each of the TOCs are setup to pick up the level 1 headings (which are throughout the document) and their unique subheadings. That part works fine. The trouble is there isn’t always a subheading of each unique style after each level 1 heading, and I only want them to appear in the TOCs when there is. In other words, I don't want the level 1 heading in the TOCs unless a subheading appears after it.





I’ve been manually deleting the entries without subheadings, but I was hoping to automate it someway. I’ve tried looping through the paragraphs and using the Paragraph.Range.Delete method to delete them but I’ve not been able to get that to work reliably. I can change the background and/or font color but can't delete them.



I also thought about using the “if” statement in the TOC field codes to check for the subheading before including the level 1 heading, but I’m not sure if that’s possible. That would be a great solution if it would work.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete a Line in a TOC Horizontal line I can't delete goingvirtual Word 2 09-09-2018 02:58 AM
Delete a Line in a TOC Delete certain characters from a line Helend269 Word VBA 5 01-09-2018 12:08 PM
Delete a Line in a TOC Delete line above sidenote JackDaniels Word 2 10-01-2016 08:04 AM
If Statement in vba to Delete a Line mbesspiata Excel Programming 4 04-08-2014 04:32 AM
Cannot delete line adkr Office 1 04-07-2010 09:26 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:09 PM.


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