Save As PDF

pagrender

Well-known Member
Joined
Sep 3, 2008
Messages
652
Hello all,

I am trying to use the macro recorder to help automate the task of saving files to a PDF, but there are limitations with the macro recorder (as you well know!).

What I would like to do alter the macro below to replace my file name with this named range: ExportToPDFName.

In other words, I would like to the "WI - New London School District 2011-16 Enr. Proj." portion of the macro to reference the ExportToPDFName named range. Can someone help me with this?

Thanks,
Pete

Sub ExportToPDF()
'
' ExportToPDF Macro
'
'
Sheets("WriteUp").Select
Range("A1").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\grender\Documents\Pete\Enrollment Projections\Districts\PDFs\WI - New London School District 2011-16 Enr. Proj..pdf" _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
End Sub
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Try this

Code:
Sub ExportToPDF()
'
' ExportToPDF Macro
'
'
Sheets("WriteUp").Select
Range("A1").Select
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"C:\Users\grender\Documents\Pete\Enrollment Projections\Districts\PDFs\" & Range("ExportToPDFName").Value & ".pdf" _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,537
Messages
6,179,405
Members
452,911
Latest member
a_barila

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top