Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-04-2019, 12:53 PM
macropod's Avatar
macropod macropod is offline TOC combine two styles into one line Windows 7 64bit TOC combine two styles into one line Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,521
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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

Tags
styles, toc format



Similar Threads
Thread Thread Starter Forum Replies Last Post
TOC combine two styles into one line Changing styles without returning to the next line ketyl Word 9 07-08-2023 07:35 PM
TOC combine two styles into one line 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
TOC combine two styles into one line Bullets within Similar Styles - Different Line Height meden1027 Word 5 05-06-2013 10:38 AM
TOC combine two styles into one line Multiple styles on same line in Microsoft Word jhopppppp Word 2 12-05-2008 10:16 AM

Other Forums: Access Forums

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