Class TableStyleElement (Excel VBA)

The class TableStyleElement represents a single table style element.

Set

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

Dim tblsty As TableStyle: Set tblsty = 
Dim tbleleTableStyleElement As TableStyleElement
Set tbleleTableStyleElement = tblsty.TableStyleElements(Index:=xlBlankRow)

The following procedures can be used to set variables of type TableStyleElement: TableStyleElements.Item and TableStyle.TableStyleElements

For Each

Here is an example of processing the TableStyleElement items in a collection.

Dim tblsty As TableStyle: Set tblsty = 
Dim tbleleTableStyleElement As TableStyleElement
For Each tbleleTableStyleElement In tblsty.TableStyleElements
	
Next tbleleTableStyleElement

Borders

Returns a Borders collection that represents the borders of a TableStyleElement object.

With ActiveWorkbook.TableStyles("Table Style 4").TableStyleElements( _ 
 xlWholeTable).Borders(xlEdgeTop) 
 .Color = 255 
 .TintAndShade = 0 
 .Weight = 2 
 .LineStyle = 1 
End With

Clear

Clears the formatting for this element.

Font

Returns a Font object that represents the font of the specified object.

HasFormat

Returns whether a table style element has formatting applied to the specified element.

Interior

Returns an Interior object that represents the interior of the specified object.

Parent

Returns the parent object for the specified object. Read-only.

StripeSize

Returns or sets the size of banding.

This property does not apply to all TableStyleElement objects. It applies only to xlColumnStripe1, xlColumnStripe2, xlRowStripe1, and xlRowStripe2 types (for more information, see XlTableStyleElementType).

TableStyleElements.Count

Returns the number of objects in the collection.

TableStyleElements.Item

Returns a single TableStyleElement object from the collection.

Syntax : expression.Item (Index)

Index: A table style element.

TableStyleElements.Parent

Returns the parent object for the specified object. Read-only.