Share via


SlicerCache Object (Excel)

Represents the current filter state for a slicer and information about which PivotCache or WorkbookConnection the slicer is connected to.

Version Information

Version Added: Excel 2010

Remarks

Use the SlicerCaches property of the Workbook object to access the collection of SlicerCache objects in a workbook.

Each slicer has a base SlicerCache object which represents the items displayed in the slicer and the current user interface state of the tiles displayed with their corresponding item captions. Each slicer control that the user sees in Excel is represented by a Slicer object that has a SlicerCache object associated with it.

Example

The following code example creates a SlicerCache object based on the Customer Geography OLAP hierarchy from the connection to the AdventureWorks database, and then creates a slicer on the Country level of that hierarchy in Sheet2 of the workbook.

With ActiveWorkbook 
 .SlicerCaches.Add("AdventureWorks", _ 
 "[Customer].[Customer Geography]").Slicers.Add SlicerDestination:="Sheet2", _ 
 Level:="[Customer].[Customer Geography].[Country]", Caption:="Country" 
End With 

See Also

Concepts

Excel Object Model Reference

SlicerCache Object Members