Class Slicer (Excel VBA)

The class Slicer represents a slicer in a workbook.

Class Workbook gives access to class Slicer.

Member in collection

Item

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

Dim slc as Slicer
Set slc = ActiveWorkbook.ActiveSlicer

The following procedures can be used to set variables of type Slicer: Slicers.Add, Slicers.Item and Workbook.ActiveSlicer.

For Each

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

Dim slc As Slicer
For Each slc In Application.Slicers
	
Next slc

Copy - Copies the specified slicer to the clipboard.

Cut - Cuts the specified slicer and copies it to the clipboard.

Delete - Deletes the slicer and removes it from the associated Slicers collection.

Slicers.Add - Creates a new slicer and returns a Slicer object.

Properties

Slicers.Item (Default member) - Returns a Slicer object from the collection.

ActiveItem returns a SlicerItem object that represents the slicer button that is currently in focus for the specified slicer.

Caption returns or sets the caption of the specified slicer.

ColumnWidth returns or sets the width, in points, of each column in the slicer.

DisableMoveResizeUI returns or sets whether the specified slicer can be moved or resized by using the user interface.

DisplayHeader returns or sets whether the header that displays the slicer Caption property is visible.

Height returns or sets the height of the specified slicer, in points.

Left returns or sets the horizontal position of the specified slicer, in points, relative to the upper-left corner of cell A1 on a worksheet.

Locked returns or sets whether the specified slicer can be modified when the sheet that contains it is protected.

Name returns or sets the name of the specified slicer.

NumberOfColumns returns or sets the number of columns in the specified slicer.

RowHeight returns or sets the height, in points, of each row in the specified slicer.

Shape returns the Shape object associated with the specified slicer.

SlicerCache returns the SlicerCache object associated with the slicer.

SlicerCacheLevel returns the SlicerCacheLevel object associated with the slicer.

SlicerCacheType returns the type of the slicer cache: slicer (xlSlicer) or timeline (xlTimeline) .

Style returns or sets the style currently applied to the specified slicer. Read/write.

TimelineViewState the timeline-specific state of the slicer.

Top returns or sets the vertical position of the specified slicer, in points, relative to the upper-left corner of cell A1 on a worksheet.

Width returns or sets the width of the specified slicer, in points.

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

Shape - Represents an object in the drawing layer, such as an AutoShape, freeform, OLE object, or picture.

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

SlicerCacheLevel - Represents a level of a hierarchy in an OLAP data source being filtered by a slicer.

SlicerItem - Represents an item in a slicer.

Style - Represents a style description for a range.

TimelineViewState - Represents the timeline-specific members of a slicer view.