Community,
I am trying to "default" some filtering so that users save time / reduce errors for some recurring reports, but stuck on setting the Pivot Field "RT...1004 : "Unable to get the PivotFields property of the PivotTable Class".
The field does exist, with that name (tried other ones too). The PT itself refers to a data table in excel.
Looking at examples around the web I really don't see an error in below code, but obviously there is. The code does work if I comment out the "Set pf01" and pf01.CurrentPage, the filters are then all cleared so the references to pivottable are correct..
Sub TestSetpvt()
Dim wks As Worksheet
Dim pvt As PivotTable
Dim pf01 As PivotField
Set wks = ActiveSheet
Set pvt = wks.PivotTables("RPT_OTH")
Set pf01 = pvt.PivotFields("Q_INCL")
pvt.ClearAllFilters
pf01.CurrentPage = "Y"