Class SlicerCacheLevels (Excel VBA)
The class SlicerCacheLevels represents the collection of hierarchy levels for the OLAP data source that is filtered by a slicer. To use a SlicerCacheLevels class variable it first needs to be instantiated, for example
Dim scls as SlicerCacheLevels
Set scls = ActiveWorkbook.SlicerCaches(1).SlicerCacheLevels
For Each
Here is an example of processing the SlicerCacheLevels items in a collection.
Dim slccl As SlicerCacheLevel
For Each slccl In ActiveWorkbook.SlicerCacheLevels
Next slccl
Count
Returns the number of levels in the specified SlicerCacheLevels collection, which represents the number of levels in the associated SlicerCache object.
Dim lngCount As Long
lngCount = ActiveWorkbook.SlicerCaches(1).SlicerCacheLevels.Count
Item
Returns the specified SlicerCacheLevel object from the collection, or if no level is specified, returns the first SlicerCacheLevel object in the collection.
Item (Level)
Level: The MDX unique name of the level or index number of the object.
ActiveWorkbook.SlicerCaches("Slicer_Country").SlicerCacheLevels("[Customer].[Customer Geography].[Country]")