04 RefreshPivot - AndrewMB2/Logic-Architect-for-Excel-VBA GitHub Wiki
RefreshPivot method
Creates a pivot table, or refreshes if it allready exists. Returns True if successful, otherwise False.
Applies to
| TableData | ArrData | RsetData | Xdata | XShared |
|---|---|---|---|---|
| ✓ | ✓ |
Parameters
| Name | Type | Description |
|---|---|---|
| Ws | Worksheet object | Worksheet to contain the pivot table. |
| PTName | String | Pivot table name |
RefreshPivot enables a pivot table to be created directly from an ArrData or RsetData object without the data needing to be on a worksheet. It uses a recordset as the data source (so RsetData must be present).
The first time it is called for a worksheet/pivot table name, it creates a new pivot table on the worksheet, which can be developed using the normal Excel user interface. On each subsequent call it refreshes the pivot table - which will need to be done when the source ArrData or RsetData object is changed.