Sub SaveInvoiceAsPDF() Dim FileName As String Dim Path As String ' Define where to save (e.g., your Desktop or a specific folder) Path = "C:\Users\YourName\Downloads\" ' Create file name using cell values (e.g., Cell B1 is Invoice #, Cell B2 is Name) FileName = Range("B1").Value & "_" & Range("B2").Value & ".pdf" ' Export the active sheet ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=Path & FileName MsgBox "Invoice Saved to: " & Path & FileName End Sub Use code with caution. Copied to clipboard
: Press Ctrl + P , and under the Printer dropdown, select "Microsoft Print to PDF" . This lets you "print" the file directly to your downloads folder as a PDF. 2. The One-Click Way (VBA Automation) Download Invoice From xlsm
If you just need to turn your current .xlsm sheet into an invoice you can send: Sub SaveInvoiceAsPDF() Dim FileName As String Dim Path
Since your file is already an .xlsm (Macro-Enabled), it’s often best to add a button that handles the naming and saving for you automatically. You can use a VBA script to pull the and Customer Name directly from cells to name the file. Sample VBA Code: Sample VBA Code: