Put A Filename On Print To Pdf In Excel Vba

[Solved] Put A Filename On Print To Pdf In Excel Vba | Vb - Code Explorer | yomemimo.com
Question : put a filename on print to pdf in excel vba

Answered by : terrible-teira-t8j8o1qszj6j

Dim strFilename As String
Dim rngRange As Range
'Considering Sheet1 to be where you need to pick file name
Set rngRange = Worksheets("Sheet1").Range("K17")
'Create File name with dateStamp
strFilename = rngRange.Value & Format(Now(), "yyyymmdd hhmmss")
Sheets(Array("Dashboard Pg 1", "Dashboard Pg 2", "Dashboard Pg 3", "Dashboard Pg 4")).Select
Sheets("Dashboard Pg 1").Activate
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ "C:\Users\Allen\Desktop\Projects\" & strFilename & ".pdf" _ , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _ :=False, OpenAfterPublish:=False
Sheets("Summary").Select

Source : https://stackoverflow.com/questions/26350314/vba-save-as-pdf-with-filename-as-cell-value | Last Update : Tue, 31 May 22

Answers related to put a filename on print to pdf in excel vba

Code Explorer Popular Question For Vb