Print range of cells to pdf to specified folder saved as a cell value

Prevost

Board Regular
Joined
Jan 23, 2014
Messages
198
Hi There,

I was looking around but could not find a direct answer and I am unsure of the print functions and parameters in VBA. What I would like to do is print a range of cells, say A5:E40, to a pdf using Adope PDF. I would also like the name of the created pdf file to be that of a certain cell value, say C7. How do I go about doing this? I read on a post that because Adobe takes time to print the pdf document, you have to add in a delay timer to the code to allow Adobe to create the pdf, not sure if this is true?

Anyways, any help is greatly appreciated!

Thanks.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
My bad. I found it. This prints the first page which works for me. I think I would be able to adjust it to print a certain cell selection on the screen.

Code:
Sub Make_PDF()
    Dim pdfName As String
    pdfName = Range("C7").Text
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="C:\Users\100043059\Desktop\" & pdfName & ".pdf" _
    , Quality:=xlQualityMedium, IncludeDocProperties:=False, _
    IgnorePrintAreas:=False, OpenAfterPublish:=True
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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