Hi Everyone,
I need some help to create a macro which will only filter one of the 6 field items in my Pivot Table, print to PDF, save in folder destination with filtered name and repeat through all the items in that specific field.
I managed to get the macro below however I cannot filter on the correct field and I need to filter through
each item(select/deselect).
I appreciate your help!
Sub PrintPivotPages()
'prints a copy of pivot table for
Application.ScreenUpdating = False
DirectoryLocation = "C:\Users\"
On Error Resume Next
Dim pt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem
Set pt = ActiveSheet.PivotTables.Item(1)
For Each pf In pt.PageFields
For Each pi In pf.PivotItems
pt.PivotFields(pf.Name).CurrentPage = pi.Name
Name = DirectoryLocation & "\" & Range("A15").Value & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Name _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
Next
Next pf
Application.ScreenUpdating = True
End Sub
Bookmarks