Share via


PivotCaches.Add Method

Adds a new PivotTable cache to a PivotCaches collection.

Namespace:  Microsoft.Office.Interop.Excel
Assembly:  Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)

Syntax

'Declaration
Function Add ( _
    SourceType As XlPivotTableSourceType, _
    SourceData As Object _
) As PivotCache
'Usage
Dim instance As PivotCaches
Dim SourceType As XlPivotTableSourceType
Dim SourceData As Object
Dim returnValue As PivotCache

returnValue = instance.Add(SourceType, _
    SourceData)
PivotCache Add(
    XlPivotTableSourceType SourceType,
    Object SourceData
)

Parameters

  • SourceData
    Type: System.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.

Return Value

Type: Microsoft.Office.Interop.Excel.PivotCache

Remarks

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

See Also

Reference

PivotCaches Interface

PivotCaches Members

Microsoft.Office.Interop.Excel Namespace