使用VBA,按sorting顺序获取数据透视表值

在Excel VBA中,我遵循以下步骤:

Created a pivot table off another sheet as datasource AutoSort the first pivot field based on the first data field 

数据透视表正确地显示一切。 现在我试图以编程方式访问第一个数据透视字段下的行,并按sorting顺序获取它们。 但是PivotTable.RowFields集合在sorting之前按原始顺序返回行。 我怎样才能以新的sorting顺序以编程方式获取行,而无需编写代码对数据进行sorting呢?

抽象的代码片段

 Dim pt As PivotTable Dim pf As PivotField Dim strval As String . . . Set pf = pt.PivotFields("first") pf.AutoSort xlDescending, "firstdata", pt.PivotColumnAxis.PivotLines(1), 1 strval = ptExtract.RowFields(1).PivotItems(1) 

在这些语句之后,数据透视表将以降序显示所有值。 但strval在sorting之前从第一行获取值。 在AutoSort之后,数据透视项目中的透视项的顺序似乎没有改变。 那么如何以新sorting的顺序获取这些值呢?

任何帮助,将不胜感激。 谢谢!