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

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

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