Share via


TableStyle.Condition Method

Word Developer Reference

Returns a ConditionalStyle object that represents special style formatting for a portion of a table.

Syntax

expression.Condition(ConditionCode)

expression   Required. A variable that represents a TableStyle object.

Parameters

Name Required/Optional Data Type Description
ConditionCode Required WdConditionCode The are of the table to which to apply the formatting.

Example

This example selects the first table in the active document and adds a 20 percent shading to odd-numbered columns.

Visual Basic for Applications
  Sub TableStylesTest()
    With ActiveDocument
    'Select the table to which the conditional
    'formatting will apply
    .Tables(1).Select

    'Specify the conditional formatting
    .Styles("Table Grid").Table _
        .<strong class="bterm">Condition</strong>(wdOddColumnBanding).Shading _
        .BackgroundPatternColor = wdColorGray20
End With

End Sub

See Also