Class ConditionalStyle (Word VBA)

The class ConditionalStyle represents special formatting applied to specified areas of a table when the selected table is formatted with a specified table style.

Set

To use a ConditionalStyle class variable it first needs to be instantiated, for example

Dim cse as ConditionalStyle
Set cse = ActiveDocument.Range.TableStyle.Condition(ConditionCode:=wdEvenColumnBanding)

ConditionalStyle class variables can be set using the TableStyle.Condition procedure.

Borders

Returns a Borders collection that represents all the borders for the specified ConditionalStyle object.

For information about returning a single member of a collection, see Returning an object from a collection.

ActiveDocument.Range.TableStyle.Condition.Borders =

BottomPadding

Returns or sets a Single that represents the amount of space (in points) to add below the contents of a single cell or all the cells in a table.

The setting of the BottomPadding property for a single cell overrides the setting of the BottomPadding property for the entire table.

ActiveDocument.Range.TableStyle.Condition.BottomPadding =

Font

Returns or sets a Font object that represents the character formatting of the specified object.

To set the Font property, specify an expression that returns a Font object.

ActiveDocument.Range.TableStyle.Condition.Font =

LeftPadding

Returns or sets the amount of space (in points) to add to the left of the contents of a single cell or all the cells in a table.

The setting of the LeftPadding property for a single cell overrides the setting of the LeftPadding property for the entire table.

ActiveDocument.Tables(1).LeftPadding = _ 
 PixelsToPoints(40, False)

ParagraphFormat

Returns or sets a ParagraphFormat object that represents the paragraph settings for the specified conditional style.

With ActiveDocument.Styles(wdStyleHeading2).ParagraphFormat 
 .TabIndent(1) 
 .Space2 
End With

Parent

Returns an object that represents the parent object of the specified ConditionalStyle object.

Dim objParent As Object
Set objParent = ActiveDocument.Range.TableStyle.Condition.Parent

RightPadding

Returns or sets the amount of space (in points) to add to the right of the contents of a single cell or all the cells in a table.

The setting of the RightPadding property for a single cell overrides the setting of the RightPadding property for the entire table.

ActiveDocument.Tables(1).RightPadding = _ 
 PixelsToPoints(40, False)

Shading

Returns a Shading object that represents the shading formatting for the style formatting of a table.

Dim shdShading As Shading
Set shdShading = ActiveDocument.Range.TableStyle.Condition.Shading

TopPadding

Returns or sets the amount of space (in points) to add above the contents of a single cell or all the cells in a table.

The setting of the TopPadding property for a single cell overrides the setting of the TopPadding property for the entire table.

ActiveDocument.Range.TableStyle.Condition.TopPadding =