PivotCaches.Add(XlPivotTableSourceType, Object) PivotCaches.Add(XlPivotTableSourceType, Object) Method


Adds a new PivotTable cache to a PivotCaches collection.

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


XlPivotTableSourceType XlPivotTableSourceType

Required XlPivotTableSourceType. The source of the PivotTable cache data. Can be one of the following XlPivotTableSourceType constants:xlConsolidationxlDatabasexlExternalxlPivotTablexlScenario

Object Object

Optional Object. The data for the new PivotTable cache. This argument is required if SourceType isn't xlExternal. Can be a Range object, an array of ranges, or a text constant that represents the name of an existing PivotTable report. For an external database, this is a two-element array. The first element is the connection string specifying the provider of the data. The second element is the SQL query string used to get the data. If you specify this argument, you must also specify SourceType.



If the PivotTable cache isn't referenced by a PivotTable object, the PivotTable cache is automatically deleted before the workbook is saved.

Applies to