How to save entire workbook as a PDF using VBA

Опубликовано: 02 Октябрь 2024
на канале: Learn In 5 Minutes
1,041
1

In this tutorial you will learn how to save entire Workbook as a PDF file using VBA macro programming in Microsoft Excel

VBA Code:

'This code will save the entire workbook as PDF
Sub SaveWorkshetAsPDF()
Dim CurrentFile As String
CurrentFile = Replace(ThisWorkbook.Name, ".xlsm", ".pdf")
ThisWorkbook.ExportAsFixedFormat xlTypePDF, "D:\demo\" & CurrentFile
MsgBox ("Workbook saved successfully")
End Sub

How to each worksheet as a separate PDF:    • How to save each worksheet as a separ...