PivotTable.AddFields Method

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

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

Syntax

'Declaration
Function AddFields ( _
    RowFields As Object, _
    ColumnFields As Object, _
    PageFields As Object, _
    AddToTable As Object _
) As Object
'Usage
Dim instance As PivotTable
Dim RowFields As Object
Dim ColumnFields As Object
Dim PageFields As Object
Dim AddToTable As Object
Dim returnValue As Object

returnValue = instance.AddFields(RowFields, _
    ColumnFields, PageFields, AddToTable)
Object AddFields(
    Object RowFields,
    Object ColumnFields,
    Object PageFields,
    Object AddToTable
)

Parameters

  • RowFields
    Type: System.Object

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

  • ColumnFields
    Type: System.Object

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

  • PageFields
    Type: System.Object

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

  • AddToTable
    Type: System.Object

    Optional Object. 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.

Return Value

Type: System.Object

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.

See Also

Reference

PivotTable Interface

PivotTable Members

Microsoft.Office.Interop.Excel Namespace