PivotTable.AddDataField Method

Adds a data field to a PivotTable report. Returns a PivotField object that represents the new data field.

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

Syntax

'Declaration
Function AddDataField ( _
    Field As Object, _
    Caption As Object, _
    Function As Object _
) As PivotField
'Usage
Dim instance As PivotTable
Dim Field As Object
Dim Caption As Object
Dim Function As Object
Dim returnValue As PivotField

returnValue = instance.AddDataField(Field, _
    Caption, Function)
PivotField AddDataField(
    Object Field,
    Object Caption,
    Object Function
)

Parameters

  • Field
    Type: System.Object

    Required Object. The unique field on the server. If the source data is Online Analytical Processing (OLAP), the unique field is a cube field. If the source data is non-OLAP (non-OLAP source data), the unique field is a PivotTable field.

  • Caption
    Type: System.Object

    Optional Object. The label used in the PivotTable report to identify this data field.

  • Function
    Type: System.Object

    Optional Object. The function performed in the added data field.

Return Value

Type: Microsoft.Office.Interop.Excel.PivotField

See Also

Reference

PivotTable Interface

PivotTable Members

Microsoft.Office.Interop.Excel Namespace