Printing PDF error with v2.4.0


I had used this printing code below on my compilled workbooks with no problems, but since I updated the version it is returning a runtime error 1004. Any help is welcome.

Sub imprPerformance()
Application.ScreenUpdating = False
Application.EnableEvents = False
activesheet.PageSetup.PrintArea = “PerformancePrint"
activesheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
Application.ThisWorkbook.Path & “\HubbleTemp” & " " & ThisWorkbook.Sheets(“Metas”).Range(“D8”).Value & " Analítico Loja.pdf”, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _

Application.EnableEvents = True
End Sub

Hello. I found the solution inside the XLS Padlock Manual.
Here is the code. It was a little difficult for me to understand the manual’s example because I’m not a Master in VBA, so I’m posting the solution to help who would have the same situation as me.

The compiled workbook does’t accept Application.ThisWorkbook.Path just because it isn’t a workbook anymore, so it’s necessary to use this function.

Public Function PathToFile(Filename As String)
Dim XLSPadlock As Object
On Error GoTo Err
Set XLSPadlock = Application.COMAddIns(“GXLSForm.GXLSFormula”).Object
PathToFile = XLSPadlock.PLEvalVar(“EXEPath”) & Filename
Exit Function
PathToFile = ""
End Function

Sub imprPerformance()

Change the Filename inside function in the Filename Printing Arguments="\HubbleTemp" & Plan4.Cells(8,4).Value & " Analítico Loja.pdf"
\HubbleTemp\ - If you want to have a subfolder to save the file
Plan4.Cells(8,4).Value - this format is better to use if you want to have a variable in the file name
The last one is the constant name of the file. If you don’t wnato to have a subfolder and a variable in the file name,
you just nedd to put it inside the function and that’s all.

Application.ScreenUpdating = False
Application.EnableEvents = False

activesheet.PageSetup.PrintArea = “PerformancePrint"
activesheet.PageSetup.Orientation = xlLandscape
Application.DisplayAlerts = False
activesheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=PathToFile(”\HubbleTemp" & Plan4.Cells(8,4).Value & " Analítico Loja.pdf"), _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True

Application.EnableEvents = True
End Sub

Thank you for your contribution!