View Single Post
 
Old 08-22-2016, 05:21 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,142
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

In the absence of a sample table, your requirement doesn't appear to make sense.

What the code appears to suggest is that if the row height is 6 point (which seems improbable) then the row is formatted as with your first set of codes, whereas if it is greater than 6 point (which seems to be the more likely scenario) it is formatted with the second set.

The only difference between the two is that the second set has the text aligned to center, whereas in the first it is left aligned.

Code:
Sub FormatTables()
Dim oTable As Table
Dim oRow As Row
    For Each oTable In ActiveDocument.Tables
        For Each oRow In oTable.Rows
            With oRow.Range
                .Font.Name = "Arial"
                .Font.ColorIndex = wdBlack
                .Font.Size = 11
                .Cells.VerticalAlignment = wdCellAlignVerticalTop
                .HighlightColorIndex = wdYellow
            End With
            If oRow.Height <= 6 Then
                oRow.Range.ParagraphFormat.Alignment = wdAlignParagraphLeft
            Else
                oRow.Range.ParagraphFormat.Alignment = wdAlignParagraphCenter
            End If
        Next oRow
    Next oTable
lbl_Exit:
    Set oRow = Nothing
    Set oTable = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote