I am trying to reference a PIVOT table filter to use as the Save As name for generating a PDF. I cannot seem to find any combination of PIVOT table object reference to do this.
Sub Deferred_Rent_To_PDF()
Dim strWorksheet As String
Dim strPivotTable As String
Dim pdfFilename As Variant
Dim strDocName As String
Dim ptDeferredRent As pivotTable
strWorksheet = "Deferred"
strPivotTable = "DeferredRent"
Set ptDeferredRent = Worksheets(strWorksheet).PivotTables(strPivotTable)
'strDocName = ptDeferredRent. <----- THIS IS WHERE I NEED HELP
pdfFilename = Application.GetSaveAsFilename(InitialFileName:=strDocName, _
FileFilter:="PDF, *.pdf", Title:="Save As PDF")
If pdfFilename <> False Then
ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=pdfFilename, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=False, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True
End If
End Sub