Export pivot table to individual PDF files

This is perfect if you have a pivot table, and you want to export multiple versions of it to separate PDF files, eg. a report per manager or OpCo to distribute further.

In this case I have a pivot table called PivotTable1 on the worksheet called Summary, and I want to export a PDF file for each value in analyis_codes4 available in the pivot table. The files will in this case be saved in directory C:\EXPORTDIRECTORY\.

Sub PDF_Indivudual_Summaries()
    Dim strPath As String
    Dim wksSource As Worksheet
    Dim PT As PivotTable
    Dim pf As PivotField
    Dim pi As PivotItem
    Set wksSource = Worksheets("Summary")
    Set PT = wksSource.PivotTables("PivotTable1")
    Set pf = PT.PivotFields("analysis_codes4")
    If pf.Orientation <> xlPageField Then
        MsgBox "There's no 'analysis_codes4' field in the Report Filter.  Try again!", vbExclamation
        Exit Sub
    End If
    strPath = "C:\EXPORTDIRECTORY\"
    If Right(strPath, 1) <> "\" Then strPath = strPath & "\"
    ActiveWorkbook.ShowPivotTableFieldList = False
    PT.PivotCache.MissingItemsLimit = xlMissingItemsNone
    With pf
        For Each pi In .PivotItems
            .CurrentPage = pi.Name
            wksSource.ExportAsFixedFormat Type:=xlTypePDF, Filename:=strPath & pi.Name & "_revenue.pdf"
        Next pi
    End With
End Sub