Run Time Error 5 - Invalid Procedure Call or Argument

gagandeepcheema

New Member
Joined
May 13, 2019
Messages
1
I am trying to export my excel sheet in pdf file but I am getting this Run Time Error 5 - Invalid Procedure Call or Argument
Can someone help me to get rid of this error and save the desired sheet to pdf file



Sub MakePdf()

Sheet1.Range("A1:C1").ExportAsFixedFormat xlTypePDF, Filename:="D:\Invoice\Export.pdf", OpenAfterPublish:=True

End Sub
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
I assume you have a sheet object Sheet1
I suppose there is the folder
Code:
D:\Invoice\


You could make a macro recording, saving the sheet as a pdf and the resulting code you put here.
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,237
Members
448,555
Latest member
RobertJones1986

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