I have a Macro that prints all of the pivot tables per report filter (name). If I print to pdf it prints every pivot table individually. What I want to do is that every pivot table (per filter option) gets combined in one pdf file. Below is the code I currently work with. I was hoping that someone knew how to adjust the print.out part to combine all the pivots to one pdf
Sub PrintAll()
'
' PrintAll Macro
' Print activity table for all employees
'
Response = MsgBox("Do you want to print the overview of all employees?", vbYesNo)
If Response = vbNo Then Exit Sub
' always refresh the table
ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh
On Error Resume Next
Dim pf As PivotField
Dim pi As PivotItem
Set pf = ActiveSheet.PivotTables("PivotTable1").PivotFields("name")
For Each pi In pf.PivotItems
ActiveSheet.PivotTables("PivotTable1").PivotFields("name").CurrentPage = pi.Name
' now check whether the current page is indeed the desired one,
' if not, the page of that e,mployee is empty so don't print
If ActiveSheet.PivotTables("PivotTable1").PivotFields("name").CurrentPage.Caption = pi.Caption Then
End If
Next
ActiveSheet.PrintOut 'use this for printing
' ActiveSheet.PrintPreview 'use this for testing
'
End Sub