PivotCaches.Create(XlPivotTableSourceType, Object, Object) Method

Definition

Creates a new PivotCache.

public Microsoft.Office.Interop.Excel.PivotCache Create (Microsoft.Office.Interop.Excel.XlPivotTableSourceType SourceType, object SourceData, object Version);
Public Function Create (SourceType As XlPivotTableSourceType, Optional SourceData As Object, Optional Version As Object) As PivotCache

Parameters

SourceType
XlPivotTableSourceType

Required SourceType can be one of the following XlPivotTableSourceType constants: xlConsolidation, xlDatabase, or xlExternal.

SourceData
Object

Optional Object The data for the new PivotTable cache.

Version
Object

Optional Object Version of the PivotTable. The version can be one of the XlPivotTableVersionList constants.

Returns

PivotCache

Remarks

The following two XlPivotTableSourceType constants are not supported when using this method: xlPivotTable and xlScenario. A run-time error is returned if one of these two constants is supplied.

The SourceData argument is required if SourceType isn't xlExternal. It can be a Range object (when SourceType is either xlConsolidation or xlDatabase) or an Excel WorkbookConnection object (when SourceType is xlExternal).

When not supplied, the version of the PivotTable will be xlPivotTableVersion12. The use of the xlPivotTableVersionCurrent constant is not allowed and returns a run-time error if it is supplied.

Applies to