Hi all:

I have a worksheet that has pivot data coming from an access database. I am trying to connect these two macros so that the workbook refreshes and then exports and saves the pdf. I've tried putting the export portion of the macro within the refresh, but when compiling I get the "expected end of sub" error. Any ideas? Thanks!

Sub AllWorksheetPivots()
Dim pt As PivotTable

    For Each pt In ActiveSheet.PivotTables
    pt.RefreshTable
    Next pt

End Sub


Public Sub Workbook_Open()

Application.ThisWorkbook.RefreshAll
 ' SaveAsPDF Macro
 ' Save this Sheet as a .PDF File
     ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
         "C:\Users\SAPagmty\Documents\Transition_Project\TBL_chart.pdf", Quality:=xlQualityStandard, _
         IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
         True

Application.DisplayAlerts = False

Application.Quit


 End Sub