![]() |
|
|
|
#1
|
||||
|
||||
|
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 |
|
#2
|
|||
|
|||
|
Dear all,
I thank you very much for your answers. I will try the macro. Greetings, Luigi |
|
| 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 |
Continuous Paragraph across two columns vs Parallel Column Paragraph
|
Pinesh | Word | 2 | 03-09-2018 04:24 PM |
Cross-reference to paragraph not updating when paragraph moves
|
windhoek2010 | Word | 1 | 09-15-2017 08:30 PM |
alphabetize a list (manual index) with entries and sub-entries
|
shmu | Word | 5 | 08-01-2016 11:15 PM |
Narrow Paragraph to Wide Paragraph HELP
|
icloudy | Word | 1 | 12-09-2012 03:49 PM |