Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 10-21-2019, 03:19 PM
Guessed's Avatar
Guessed Guessed is offline TOC entries in one paragraph Windows 10 TOC entries in one paragraph Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,185
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

Charles is right but you can retrofit a table of contents after refreshing it to do basically what you are asking. The following macro could be used to refresh your TOC and then compact it.
Code:
Sub CompactTOCUpdater()
  Dim aRng As Range, aTOC As TableOfContents
  Set aTOC = ActiveDocument.TablesOfContents(1)
  Set aRng = aTOC.Range
  aTOC.Update
  With aRng.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "^t"
    .Replacement.Text = ", "
    .Forward = True
    .Wrap = wdFindStop
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .Execute Replace:=wdReplaceAll
    .Text = "^p"
    .Replacement.Text = " – "
    .Execute Replace:=wdReplaceAll
  End With
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
 

Tags
table of contents



Similar Threads
Thread Thread Starter Forum Replies Last Post
Why does paragraph inherit style of the following paragraph? WADEVCAMP Word VBA 2 04-08-2019 02:13 PM
TOC entries in one paragraph Continuous Paragraph across two columns vs Parallel Column Paragraph Pinesh Word 2 03-09-2018 04:24 PM
TOC entries in one paragraph Cross-reference to paragraph not updating when paragraph moves windhoek2010 Word 1 09-15-2017 08:30 PM
TOC entries in one paragraph alphabetize a list (manual index) with entries and sub-entries shmu Word 5 08-01-2016 11:15 PM
TOC entries in one paragraph Narrow Paragraph to Wide Paragraph HELP icloudy Word 1 12-09-2012 03:49 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:11 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