PivotCaches.Create Method

Excel Developer Reference

Creates a new PivotCache.

Version Information
 Version Added:  Excel 2007

Syntax

expression.Create(SourceType, SourceData, Version)

expression   A variable that represents a PivotCaches object.

Parameters

Name Required/Optional Data Type Description
SourceType Required XlPivotTableSourceType SourceType can be one of these xlPivotTableSourceType constants: xlConsolidation, xlDatabase, or xlExternal.
SourceData Optional Variant The data for the new PivotTable cache.
Version Optional Variant Version of the PivotTable. The version can be one of the xlPivotTableVersionList constants.

Return Value
PivotCache

Remarks

The following two xlPivotTableSourceType constants are not supported when creating a PivotCache 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 Workbook Connection 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.

See Also