Attribute VB_Name = "ExportToPdf" ' 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