Edytuj

Udostępnij za pośrednictwem


SlicerCaches.Add2(Object, Object, Object, Object) Method

Definition

Adds a new SlicerCache object to the collection.

public Microsoft.Office.Interop.Excel.SlicerCache Add2 (object Source, object SourceField, object Name, object SlicerCacheType);
Public Function Add2 (Source As Object, SourceField As Object, Optional Name As Object, Optional SlicerCacheType As Object) As SlicerCache

Parameters

Source
Object

The data source that the new SlicerCache will be based on. The argument passed to the Source parameter can be a WorkbookConnection object, a PivotTable object, or a string. If a PivotTable object is passed, the associated PivotCache object is used as the data source. If a string is passed, it is interpreted as the name of a WorkbookConnection object, and if no such WorkbookConnection object exists, a run-time error is generated.

SourceField
Object

The name of the field in the data source to filter by. For non-OLAP data sources, use the PivotField object from the PivotCache object that the slicer is based on, or the unique name of that object (the value of the Name property). For OLAP data sources, use the MDX unique name of the hierarchy that the SlicerCache is based on. You can also specify a level of the OLAP hierarchy, and Excel will use the corresponding hierarchy.

Name
Object

The name Excel uses to reference the slicer cache (the value of the SlicerCache.Name property). If omitted, Excel will generate a name. By default, Excel concatenates "Slicer_" with the value of the PivotField.Caption property for slicers with non-OLAP data sources, or with the value of the CubeField.Caption property for slicers with OLAP data sources. (Replacing any spaces with "_".) If required to make the name unique in the workbook namespace, Excel adds an integer to the end of the generated name. If you specify a name that already exists in the workbook namespace, the Add method will fail.

SlicerCacheType
Object

Designates the type of slicer or slicer cache.

Returns

Applies to