Class SlicerItems (Excel VBA)

The class SlicerItems represents the collection of SlicerItem objects contained in a SlicerCache or SlicerCacheLevel object. To use a SlicerItems class variable it first needs to be instantiated, for example


Dim sis as SlicerItems
Set sis = ActiveWorkbook.SlicerCaches(1).SlicerItems

For Each

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


Dim slcite As SlicerItem
For Each slcite In ActiveWorkbook.SlicerItems
	
Next slcite

Count

Returns the number of objects in the collection.


Dim lngCount As Long
lngCount = ActiveWorkbook.SlicerCaches(1).SlicerItems.Count

Item

Returns a SlicerItem object from a collection.

Item (Index)

Index: The name or index number of the SlicerItem object.


Dim slciteItem As SlicerItem
Set slciteItem = ActiveWorkbook.SlicerCaches(1).SlicerItems(Index:=1)