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