79439964

Date: 2025-02-14 16:22:41
Score: 0.5
Natty:
Report link

Still unsure what was causing the previous error but exporting to PDF rather than printing seems to have resolved the issue.

'Export as PDF
Set selectedRange = Range("Top_Corner:Bottom_Corner")
fileDatePart = Format(Now(), "yyyy-mm-dd") ' Format the date
fileTimePart = Format(Now(), "hh-mm-ss") ' Format the time (24-hour format)
filePath = Application.GetSaveAsFilename(InitialFileName:="OrificeCalculations_" & fileDatePart & "_" & fileTimePart & ".pdf", FileFilter:="PDF Files (*.pdf), *.pdf")
If filePath = "False" Then GoTo Error:
selectedRange.ExportAsFixedFormat Type:=xlTypePDF, Filename:=filePath, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Jake C