run time error 5 invalid procedure call or argument

nagender sharma

New Member
Joined
Apr 1, 2016
Messages
1
Hello friends, i am using macro for print, save and move data to next sheet but facing "run time error 5 invalid procedure call or argument " error, friends Anyone can tell me where is the problem in coding and my coding is below:

' Print, Save PDF, Transfer Data
Private Sub CommandButton4_Click()
ActiveCell.Offset(0, 1).Range("A1:A16").Select
Selection.Copy
ActiveSheet.Next.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
ActiveCell.Offset(1, 0).Range("A1").Select
ActiveSheet.Previous.Select
Range("A1").Select
Application.CutCopyMode = False
Selection.ClearContents
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ExecuteExcel4Macro "PRINT(1,,,2,,,,,,,,1,,,TRUE,,FALSE)"
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
Dim Path As String
Dim FileName1 As String
Dim FilaName2 As String
Path = "C:\Invoice\"
FileName1 = Range("B2")
FileName2 = Range("J1")
With Sheets("Invoice")
.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=Path & FileName1 & "-" & FileName2 & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
End With
End Sub
 

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.
Welcome to the Board!

If you click "Debug", which line of code does it highlight (that is where the problem probably is)?
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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