Strangely I actually found this exact question posted on another forum, but the solution didn't work for me.

All I need to do is write some code to print/open a worksheet as a pdf, but NOT to save it - the file will be used by different people on different machines/networks, so the filepath would just cause an error (and I want users to decide for themselves whether to save the report). I recorded a macro and it works with a save. If I remove the filename bit, I get an error saying "not saved" or something.

This is the macro I recorded:


Sub pdf()
'

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
        "C:\Users\bevc\Documents\ThisWouldBeMyReport.pdf", Quality:= _
        xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
        OpenAfterPublish:=True
End Sub
Can anyone please tell me how I can remedy this and just open a sheet as a pdf, without saving? Thank you.