Class TableStyleElements (Excel VBA)

The class TableStyleElements represents table style elements. To use a TableStyleElements class variable it first needs to be instantiated, for example


Dim tses as TableStyleElements
Set tses = ActiveWorkbook.DefaultPivotTableStyle.TableStyleElements

For Each

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


Dim tblele As TableStyleElement
For Each tblele In ActiveWorkbook.DefaultPivotTableStyle.TableStyleElements
	
Next tblele

Count

Returns the number of objects in the collection.


Dim lngCount As Long
lngCount = ActiveWorkbook.DefaultPivotTableStyle.TableStyleElements.Count

Item

Returns a single TableStyleElement object from the collection.

Item (Index)

Index: A table style element.


Dim tblele As TableStyleElement
Set tblele = ActiveWorkbook.DefaultPivotTableStyle.TableStyleElements(Index:=1)