Class TableStyles (Excel VBA)

The class TableStyles represents styles that can be applied to a table. To use a TableStyles class variable it first needs to be instantiated, for example


Dim tss as TableStyles
Set tss = ActiveWorkbook.TableStyles

Add

Creates a new TableStyle object and adds it to the collection.

Add (TableStyleName)

TableStyleName: The name of the table style.


Dim strTableStyleName As String: strTableStyleName = 
Dim tblsty As TableStyle
Set tblsty = ActiveWorkbook.TableStyles.Add(TableStyleName:=strTableStyleName)

Count

Returns the number of objects in the collection.


Dim lngCount As Long
lngCount = ActiveWorkbook.TableStyles.Count

Item

Returns a single TableStyle object from the collection.

Item (Index)

Index: The name or index number for the object.


Dim tblsty As TableStyle
Set tblsty = ActiveWorkbook.TableStyles(Index:=1)