I, too, have been struggling with the same problem in Excel 2000.
I've recorded a macro where I've dragged a field into the DataField
area and pulled it back out again to hide it, but when I try to play
the macro back, it fails with the message "Unable to set the
Orientation property of the PivotField class". Here's the code:
Sub Macro8()
With ActiveSheet.PivotTables("PivotTable1").PivotFields ("EndBal")
.Orientation = xlDataField
.Position = 1
End With
ActiveSheet.PivotTables("PivotTable1").PivotFields ("Count of
EndBal").Orientation = xlHidden <====== FAILS HERE (also fails with
"EndBal" instead of "Count of EndBal")
End Sub
So far, the only workaround that seems to do the job is to delete the
cell with the fieldname in it: Range("A4").Delete
Of course, you have to figure out which cell has the field header in it
in order to delete it. Have you found any other way to do it?
Dave G
------------------------------------------------
~~ Message posted from
http://www.ExcelTip.com/
~~ View and post usenet messages directly from
http://www.ExcelForum.com/