![]() |
|
|
|
#1
|
||||
|
||||
|
Try combining the following macro with a change in your TOC field, from:
"Heading 2,2,Heading 3,3,ATA MEL Item,5" to: "Heading 2,2,Heading 3,3" \f Code:
Sub Demo()
Application.ScreenUpdating = False
Dim Tbl As Table, r As Long, Rng As Range, StrTC As String
For Each Tbl In ActiveDocument.Tables
With Tbl
If Split(.Cell(1, 1).Range.Text, vbCr)(0) = "ATA - SYSTEM &" Then
For r = 5 To .Rows.Count
StrTC = "TC " & Chr(34) & Split(.Cell(r, 1).Range.Text, vbCr)(0)
Set Rng = .Cell(r, 2).Range
With Rng
.End = .End - 1
StrTC = StrTC & " " & .Text & Chr(34) & " \l 5"
.Collapse wdCollapseEnd
.Fields.Add .Duplicate, wdFieldEmpty, StrTC, False
End With
Next
End If
End With
Next
Application.ScreenUpdating = True
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
| Tags |
| styles, toc format |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Changing styles without returning to the next line
|
ketyl | Word | 9 | 07-08-2023 07:35 PM |
Table styles - First column shading with bottom line on page break
|
NicB | Word Tables | 2 | 02-20-2019 03:05 AM |
| Question about spacing between multi-level bullet styles (and other styles) | SDwriter | Word | 0 | 09-26-2017 09:39 AM |
Bullets within Similar Styles - Different Line Height
|
meden1027 | Word | 5 | 05-06-2013 10:38 AM |
Multiple styles on same line in Microsoft Word
|
jhopppppp | Word | 2 | 12-05-2008 10:16 AM |