AddFields Method

AddFields Method

See Also         Example         Applies To

Adds row, column, and page fields to a PivotTable report or PivotChart report.

Syntax

expression.AddFields(RowFields, ColumnFields, PageFields, AddToTable, AppendField)

expression   Required. An expression that returns a PivotTable object.

RowFields   Optional Variant. Specifies a field name (or an array of field names) to be added as rows, or to be added to the category axis.

ColumnFields   Optional Variant. Specifies a field name (or an array of field names) to be added as columns, or to be added to the series axis.

PageFields   Optional Variant. Specifies a field name (or an array of field names) to be added as pages, or to be added to the page area.

AddToTable   Optional Variant. Applies only to PivotTable reports. True to add the specified fields to the report (none of the existing fields are replaced). False to replace existing fields with the new fields. The default value is False.

AppendField   Optional Boolean. Applies only to PivotChart reports. True to add the specified fields to the report (none of the existing fields are replaced). False to replace existing fields with the new fields. The default value is False.

Remarks

You must specify one of the field arguments.

Field names specify the unique name returned by the SourceName property of the PivotField object.

This method is not available for OLAP data sources.