0

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
Community
  • 1
  • 1
Santos Lee
  • 29
  • 4

1 Answers1

1

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"
Maki
  • 625
  • 4
  • 11
  • 26