View Single Post
 
Old 01-15-2019, 08:57 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,166
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

Try something like the following, whereby I loop across the cells until I hit the second row
Code:
Sub FormatFirstTableRow2()
  Dim Tbl As Table, i As Long, iRow As Row, sCellText As String, aCell As Cell
  Application.ScreenUpdating = False
  For Each Tbl In ActiveDocument.Tables
    With Tbl
      sCellText = Trim(.Range.Cells(1).Range.Words(1))
      If sCellText = "Table" Or sCellText = "Figure" Then
        For Each aCell In .Range.Cells
          If aCell.RowIndex > 1 Then Exit For
          aCell.Range.Style = "TblHeader"
          aCell.Borders.Enable = False
          aCell.Borders(wdBorderBottom).LineStyle = Options.DefaultBorderLineStyle
          aCell.Range.Cells.VerticalAlignment = wdCellAlignVerticalCenter
        Next aCell
        .AutoFitBehavior (wdAutoFitContent)
        .Rows.HeightRule = wdRowHeightExactly
        .Rows.Height = InchesToPoints(0.2)
      End If
    End With
  Next
  ActiveDocument.Fields.Update
  Application.ScreenUpdating = True
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote