共用方式為


PivotTable.DataPivotField Property (Excel)

Returns a PivotField object that represents all the data fields in a PivotTable. Read-only.

Syntax

expression .DataPivotField

expression A variable that represents a PivotTable object.

Example

This example moves the second PivotItem object to the first position. It assumes a PivotTable exists on the active worksheet and that the PivotTable contains data fields.

Sub UseDataPivotField() 
 
 Dim pvtTable As PivotTable 
 
 Set pvtTable = ActiveSheet.PivotTables(1) 
 
 ' Move second PivotItem to the first position in PivotTable. 
 pvtTable.DataPivotField.PivotItems(2).Position = 1 
 
End Sub

請參閱

概念

PivotTable Object Members

PivotTable Object