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"
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"