PivotTables.Add Method
Adds a new PivotTable report. Returns a PivotTable object.
Syntax
expression.Add(PivotCache, TableDestination, TableName, ReadData, DefaultVersion)
expression A variable that represents a PivotTables object.
Parameters
| Name | Required/Optional | Data Type | Description |
|---|---|---|---|
| PivotCache | Required | PivotCache | The PivotTable cache on which the new PivotTable report is based. The cache provides data for the report. |
| TableDestination | Required | Variant | The cell in the upper-left corner of the PivotTable report's destination range (the range on the worksheet where the resulting report will be placed). You must specify a destination range on the worksheet that contains the PivotTables object specified by expression. |
| TableName | Optional | Variant | The name of the new PivotTable report. |
| ReadData | Optional | Variant | True to create a PivotTable cache that contains all records from the external database; this cache can be very large. False to enable setting some of the fields as server-based page fields before the data is actually read. |
| DefaultVersion | Optional | Variant | The version of Microsoft Excel the PivotTable was originally created in. |
Return Value
A PivotTable object that represents the new PivotTable report.
Example
This example creates a new PivotTable cache based on an OLAP provider, and then it creates a new PivotTable report based on the cache, at cell A1 on the first worksheet.
| Visual Basic for Applications |
|---|
|