TableStyle.Condition method (Word)

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 area 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.

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 _ 
 .Condition(wdOddColumnBanding).Shading _ 
 .BackgroundPatternColor = wdColorGray20 
 End With 
End Sub

See also

TableStyle Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.