PivotCaches.Add(XlPivotTableSourceType, Object) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
Parameters
- SourceType
- XlPivotTableSourceType
Required XlPivotTableSourceType. The source of the PivotTable cache data. Can be one of the following XlPivotTableSourceType constants:xlConsolidationxlDatabasexlExternalxlPivotTablexlScenario
- SourceData
- 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
.
Returns
Remarks
If the PivotTable cache isn't referenced by a PivotTable object, the PivotTable cache is automatically deleted before the workbook is saved.