Excel VBA Save As PDF: Step-By-Step Guide And 10 Examples

Table of Contents

Toggle
  • How To Save An Excel File As PDF Using VBA: The ExportAsFixedFormat Method
    • Parameter #1: Type
    • Parameter #2: Filename
    • Parameter #3: Quality
    • Parameter #4: IncludeDocProperties
    • Parameter #5: IgnorePrintAreas
    • Parameters #6 And #7: From And To
    • Parameter #8: OpenAfterPublish
    • Parameter #9: FixedFormatExtClassPtr
  • How To Save An Excel File As PDF Using VBA: Basic Code Examples (Examples #1 And #2)
    • How To Save An Excel File As PDF Using VBA: Code Example #1
    • How To Save An Excel File As PDF Using VBA: Code Example #2
  • How To Adjust The Page Setup To Save An Excel File As PDF Using VBA: The PageSetup Object
    • The PageSetup Object: Properties
    • How To Save An Excel File As PDF Using VBA: Code Example #3
  • How To Change The Filename When Saving An Excel File As PDF Using VBA: How To Work With The Filename Parameter Of The ExportAsFixedFormat Method
    • Use #1 (Examples #4, #5, #6 And #7): How To Specify The Full Path And Name Of A PDF File Using The Filename Parameter Of The ExportAsFixedFormat Method
    • Use #2 (Example #8): How To Name A PDF File Using The Application.GetSaveAsFilename Method
  • How To Save Each Worksheet As A Separate PDF Using VBA: How To Use Loops With The ExportAsFixedFormat Method (Examples #9 And #10)
    • Row #1: Dim iCounter As Integer
    • Row #2: For iCounter = 1 To Worksheets.Count
    • Row #3: With Worksheets(iCounter).PageSetup
    • Rows #4 To #11: With… End With Block
    • Rows #12 To #20: Worksheets(iCounter).ExportAsFixedFormat
  • Conclusion

Từ khóa » Visual Basic Excel Print To Pdf