singathala
New Member
- Joined
- Jul 3, 2018
- Messages
- 2
Dear Sir, I need to save one invoice template by changing data upto specified invoice no's. But my code showing an error. Kindly help me.
Error image
HTML:
Sub Savepdf()Dim from, to1 As VariantDim flname As StringDim filepath As Stringfrom = Sheets("Invoice").Range("E3")to1 = Sheets("Invoice").Range("E4")
For i = from To to1Sheets("Invoice").Range("E2") = i
filepath = Application.ActiveWorkbook.Pathflname = Sheets("Invoice").Range("D3") Sheets("Invoice").ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ filepath & "\" & flname, Quality:=xlQualityStandard, _ IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _ FalseNext i
MsgBox ("File saved in " & filepath)End Sub
Error image