mardi 24 février 2015

Pivot table page filter count elements

I have a pivot table where I cycle through of all items found in pivot table page filter (Between the cycles I print the page) I would like to determine how many elements can be found in the filter. I can not find such an option.


I also run into issues when the pivot item reaches the last (blank) element.



Dim pt As PivotTable, pi As PivotItem, pf As PivotField
Set pt = Sheets("Partner Invoice").PivotTables("PivotTable3")
Set pf = pt.PageFields(1)
For Each pi In pf.PivotItems

Application.StatusBar = lLoop & " / " & something
ActiveSheet.PivotTables("PivotTable3").PivotFields("Partner").CurrentPage = pi.Value

On Error GoTo errmsg
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"somewhere" & Trim(pi.Value) & ".pdf", Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
On Error GoTo 0

End If

lLoop = lLoop + 1
Next pi

Aucun commentaire:

Enregistrer un commentaire