Hi Folks,
I am trying to print my excel worksheet to PDF with a range as the filename with a date time stamp included.
My code below only gives me a the filename as the prefix in the pdf
Any thoughts?
Thanks
[VBA]
Sub PrintToPDF()
Dim filesavename As String
pdfName = ActiveSheet.Name
ChDir ActiveWorkbook.Path & "\"
strtime = Format(Now(), "yyyymmdd\_hhmm")
filesavename = Range("E3").Value
strFile = filesavename & "_" & strtime & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:=filesavename _
, quality:=xlQualityStandard, includedocproperties:=True, ignoreprintareas _
:=False, openafterpublish:=True
MsgBox "File Saved " & " " & filesavename
End Sub
[/VBA]