Class TableStyle (Excel VBA)

The class TableStyle represents a single style that can be applied to a table or slicer.

The classes ListObject and Workbook. give access to class TableStyle

Member in collection

Item

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

Dim tblsty as TableStyle
Set tblsty = ActiveWorkbook.DefaultPivotTableStyle

The following procedures can be used to set variables of type TableStyle: ListObject.TableStyle, Duplicate, TableStyles.Add, TableStyles.Item, Workbook.DefaultPivotTableStyle and Workbook.DefaultTableStyle.

For Each

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

Dim tblstyDefaultSlicerStyle As TableStyle
For Each tblstyDefaultSlicerStyle In Application.DefaultSlicerStyle
	
Next tblstyDefaultSlicerStyle

Methods

Delete - Deletes the TableStyle object.

Duplicate - Duplicates the TableStyle object and returns a reference to the new copy.

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

TableStyles.Item - Returns a single TableStyle object from the collection.

Properties

Name (Default member) - Returns the name of the object.

BuiltIn true if the style is a built-in style.

NameLocal returns or sets the name of the object in the language of the user.

ShowAsAvailablePivotTableStyle sets or returns whether a style is shown in the gallery for PivotTable styles.

ShowAsAvailableSlicerStyle returns or sets whether the specified table style is shown as available in the slicer styles gallery.

ShowAsAvailableTableStyle returns or sets a table style shown as available in the table styles gallery.

ShowAsAvailableTimelineStyle returns or sets whether the specified table style is shown as available in the timeline styles gallery.

TableStyleElements returns the TableStyleElements object.

TableStyles.Count returns the number of objects in the collection.

TableStyleElements - Represents table style elements.