Automation · VBA
Export Sheet to PDF
Save the active sheet as a PDF next to your workbook.
- One-click PDF export
- Saves next to the workbook
- Opens the PDF when done
' Exports the active sheet to a PDF saved next to the workbook.
Sub ExportActiveSheetToPDF()
Dim path As String
If ThisWorkbook.Path = "" Then
MsgBox "Please save the workbook first.", vbExclamation
Exit Sub
End If
path = ThisWorkbook.Path & "\" & ActiveSheet.Name & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=path, _
Quality:=xlQualityStandard, OpenAfterPublish:=True
MsgBox "Saved: " & path, vbInformation
End Sub
Free to use and modify · ExcelBot — excelempowers.com
Exports the active worksheet to a PDF file saved in the same folder as the workbook and opens it.
How to install:
- Open your workbook and press Alt + F11 to open the VBA editor.
- Choose Insert ▸ Module and paste the code (or File ▸ Import File for the .bas).
- Press F5 to run, or run it from Developer ▸ Macros.
- Save your file as .xlsm (macro-enabled) to keep the macro.
No VBA? In ExcelBot you can do the same thing by just asking the AI in plain language.
export pdf
save as pdf
exportar pdf
vba
Rather not use VBA?
In ExcelBot you get the same result by asking the AI in plain language — no macros needed.
Try ExcelBot free Browse more macros