Santos Lee
Santos Lee

Reputation: 29

How to export from Excel to PDF to a determined location?

I have this code to export to PDF, but it goes to the documents folder. I'd like to export it to a different location. How do I do that?

This is the code:

Private Sub CommandButton1_Click()

    Range("a1:k44").Select
    Selection.ExportAsFixedFormat Type:=xlTypePDF, _
        Filename:=ru & "REMITO " & Range("C7") & ".pdf", _
        Quality:=xlQualityStandard, IncludeDocProperties:=True, _
        IgnorePrintAreas:=False, OpenAfterPublish:=False

End Sub

Upvotes: 0

Views: 56

Answers (1)

Maki
Maki

Reputation: 637

Export excel as PDF to a specific path, you can use the code below. You will need to adjust it to your needs, this is the base.

Private Sub CommandButton1_Click()

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="path_here+filename.pdf"

End sub

Example:

Filename:="C:\Documents\newfolder2\archive.pdf"

Upvotes: 1

Related Questions