Dim timeStamp As String timeStamp = Format(Now, "yyyymmdd_hhnnss") filePath = "C:\Reports\Report_" & timeStamp & ".pdf" Avoid creating empty PDFs:

Dim folder As String folder = ThisWorkbook.Path & "\" filePath = folder & "MyReport.pdf" Prevent duplicate names by adding the current date/time:

'Loop through each worksheet For Each ws In ThisWorkbook.Worksheets ws.ExportAsFixedFormat Type:=xlTypePDF, _ Filename:=folderPath & ws.Name & ".pdf", _ Quality:=xlQualityStandard Next ws

Sub SaveEachSheetAsPDF() Dim ws As Worksheet Dim folderPath As String 'Create a folder (adjust as needed) folderPath = "C:\PDF Reports\AllSheets\"

Sub ExportSingleSheetToPDF() Dim ws As Worksheet Dim filePath As String Set ws = ActiveSheet filePath = "C:\PDF Reports\" & ws.Name & ".pdf"

'Create dynamic path filePath = "C:\Invoices\" & invoiceNum & "_" & customerName & ".pdf"

'Check if folder exists; if not, create it If Dir(folderPath, vbDirectory) = "" Then MkDir folderPath End If

'Get values from cells invoiceNum = ws.Range("B5").Value customerName = ws.Range("B6").Value customerName = Replace(customerName, " ", "_") 'Remove spaces