View Single Post
 
Old 02-28-2022, 03:01 PM
Guessed's Avatar
Guessed Guessed is online now Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,177
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

It is easy enough to assign paragraph styles to the tables as you go. You can code it to do a whole row but if any table has vertically merged cells then you will need to be able to handle the error that arises from that approach. Instead, you can take the slower path of applying styles at the cell level which avoids that possible error. I've highlighted the code to add showing where it sits in the above code.
Code:
          For Each oCell In oTbl.Range.Cells
            With oCell
              .TopPadding = 0
              .BottomPadding = 0
              .LeftPadding = 0
              .RightPadding = 0
              Select Case .RowIndex
                Case 1
                  .Range.Style = "Heading 1"
                Case 2
                  .Range.Style = "Heading 2"
                Case 3
                  .Range.Style = "Heading 3"
                Case Else
                  .Range.Style = "Heading 4"
              End Select
            End With
          Next oCell
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote