Export to PDF not working after compile - SOLVED

lkern

New member
Hi again.

I have several macros to print certain sheets to PDF in my spreadsheet. The work in my uncompiled spreadsheet.

After compiling to exe they no longer work. I do have the option to export to PDF selected.

Any help is appreciated. I am using version 2020.1 of XLS Padlock.

Edited to add: It turns out that it does create the document, but it does not open it like it does before compiling. It leaves a blank screen up that you have to close and then go looking for the document.

Is there a way to make it show the PDF after it is created, like it does before compiling?
 
Last edited by a moderator:
Could you post the VBA code you’re using to generate the PDF file? Especially the lines that deal with the PDF’s filepath.
 
Here’s the code for one of them:
Code:
Sub CCsummaryPDF(control As IRibbonControl)

Dim PdfFilename As Variant

Sheets("SUMMARY-Cupcakes Information").Select
Range("A1").Select

PdfFilename = Application.GetSaveAsFilename( _
    InitialFileName:="CustomerName_CupcakeSummary", _
    FileFilter:="PDF, *.pdf", _
    Title:="Save As PDF")

If PdfFilename <> False Then

    With ActiveSheet.PageSetup
        .Orientation = xlLandscape
        .PrintArea = "$C$1:$H$24"
        .PrintTitleRows = ActiveSheet.Rows(13).Address
        .Zoom = False
        .FitToPagesTall = False
        .FitToPagesWide = 1
    End With

    ActiveSheet.ExportAsFixedFormat _
        Type:=xlTypePDF, _
        Filename:=PdfFilename, _
        Quality:=xlQualityStandard, _
        IncludeDocProperties:=False, _
        IgnorePrintAreas:=False, _
        OpenAfterPublish:=True

End If 

End Sub
 
No, that hung up the program. Task Manager isn’t even closing it. 😐

Edited to say: I have put it in several places after ActiveSheet.ExportAsFixedFormat
but I get an error:
Code:
Compile Error: Expected: End of Statement
with the PdfFilename highlighted
 
Last edited:
I went on and left the option to open after creating False because it is better than having the weird blank screen open, but I would like the option to open the PDF after creating it to work.
 
Sure, we’ll check what could be the problem. But maybe it’s a local problem: what is your PDF reader software?
 
Last edited:
I have the full version of Adobe Acrobat on my computer, but Microsoft Edge is the window that opens when creating the PDF. Is there a way to default it to Adobe?
 
Back
Top