Print to PDF selction only

michaelsmithgall

New Member
Joined
Feb 22, 2011
Messages
19
I use the following code to print a worksheet to PDF. Its works well. However I have added a new sheet and i want to do almost the same thing but this new sheet extra stuff on the page that i dont want printed. Only want to print A1 through C59. I know its some sort of active sheet and range configuration but Im not figuring it out. Any ideas?



Private Sub CommandButton2_Click()
Dim LoanNo, Filename, Borrowername, Filedate, Filetime As String
LoanNo = Worksheets("Income Summary").Range("C5").Value
Heritage = Worksheets("Income Summary").Range("C7").Value
Filedate = Format(Date, "mmddYYYY")
Filetime = Format(Now(), "MMDDYYYY")
Borrowername = Worksheets("Income Summary").Range("C4").Value
Filename = Borrowername & " - " & LoanNo & " - " & "INCOME CALC" & " - " & Filedate

ThisWorkbook.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"H:\" & Filename & ".pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
True
MsgBox "File has been saved to H:\" & Filename & ".pdf"
ActiveWorkbook.SaveCopyAs Filename:="H:\" & Borrowername & " - " & LoanNo & " - " & Filetime & ".xls"
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,224,503
Messages
6,179,134
Members
452,890
Latest member
Nikhil Ramesh

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