Print to PDF Single Page from Worksheet

walters303

New Member
Joined
Jan 28, 2015
Messages
2
Using Excel 2013. I have several different worksheets with varying number of pages. I'm looking to put a macro button on the different pages that I want to print-to-pdf so that all i need to do is click the button and THAT particular page prints.

When it prints-to-pdf I want the pdf page to automatically go to my desktop with the worksheet name and nothing else. The vba code that allows me to do this with in a completely different situation is below. Note: I dont want the date to be part of the filename. Thanks for the help!

Sub Save_ActSht_as_Pdf()
' Saves active sheet as PDF file.
Dim Name As String

Name = ThisWorkbook.Path & "\" & ActiveSheet.Name & " " & _
Format(Now(), "mm.dd.yy") & ".pdf"

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Name, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
End Sub
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Perhaps this??
Rich (BB code):
Sub SaveCopy()
Dim ArchiveFolder as string, ArchiveFileName as string
ArchiveFolder = CreateObject("WScript.Shell").SpecialFolders("Desktop") & "\"
ArchiveFileName = ActiveSheet.Name
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:=ArchiveFolder & ArchiveFileName & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End Sub
 
Upvote 0
So you just want to remove date from file name and change it to save on Desktop?

Correct. I want the title of the active page pdf to just be the worksheet name. No date. I just included that macro bc i have success with it. Thanks.
 
Upvote 0
Also don't use variable names like "Name" it is a reserved word and can give you issues :).

Cheers

Dan
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,256
Members
448,557
Latest member
richa mishra

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