Help to "combine" 2 scripts..

iRobert

New Member
Joined
May 15, 2019
Messages
28
Hello,
I have this script:
Rich (BB code):
<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit; line-height: 12px;">Sub saveInvNew() 'Save record to Master Sheet
Sheets("Invoice").Unprotect
Sheets("Master").Unprotect
On Error GoTo ErrHandler
Dim cpyArr, wbMas As Worksheet, qClr As String, ansCl As String, wbInv As Worksheet
'ActiveSheet.Unprotect
With Worksheets("Master")
        .Range("A1").CurrentRegion.Sort Key1:=.Range("A1"), _
            Order1:=xlAscending, Header:=xlYes
    End With
cpyArr = Array(Range("B13").Value, Range("C13").Value, Range("f16").Value, Range("c16").Value, Range("a8").Value, Range("J15").Value, Range("e16").Value, Range("a16").Value, Range("A18").Value, Range("b18").Value, Range("F13").Value, Range("f18").Value, Range("f41").Value, Range("f33").Value, Range("r6").Value, Range("r4").Value, Range("m6").Value, Range("m4").Value, Range("n17").Value, Range("s16").Value, Range("s18").Value, Range("S43").Value, Range("S44").Value, Range("S45").Value)
Set wbMas = Worksheets("Master")
Set wbInv = Worksheets("Invoice")
wbMas.Range("A" & wbMas.Cells(Rows.Count, "A").End(xlUp).Row + 1).Resize(, 24) = cpyArr
qClr = "Do you wish to print a copy of the invoice sheet?"
ansCl = MsgBox(qClr, vbYesNo + vbQuestion, "Print Invoice Sheet?")
If ansCl = vbYes Then
wbInv.PageSetup.PrintArea = "$A$1:$g$56"
wbInv.PrintOut copies:=1
End If
Sheets("Invoice").Protect
Sheets("Master").Protect
fsy
clrInv
Exit Sub
ErrHandler:
MsgBox "Error with Invoice (Save New Invoice)- error " & Err.Number & _
" - " & Err.Description
End Sub

and I would like to add this sub() right under the lines:
Rich (BB code):
wbInv.PrintOut copies:=1
End If


Rich (BB code):
<code style="margin: 0px; padding: 0px; font-style: inherit; font-weight: inherit; line-height: 12px;">Sub Create_PDF()
'
' Create_PDF Macro
'
   ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
ActiveWorkbook.Path & "\Invoicing\PDF Files\" & ActiveWorkbook.Name, Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
End Sub


Can anyone help me?
Thanks and best regards to all....with admiration!!!

iR</code></code>
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Try

Code:
wbInv.PrintOut copies:=1
End If
call Create_PDF
 
Upvote 0
What error do you get ??
AND
Which sheet do you want exported to PDF ??
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,151
Messages
6,123,321
Members
449,094
Latest member
Chestertim

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