• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Export Excel to PDF

sgmpatnaik

Active Member
Hi


I have a code which is export from Excel to PDF, it was worked but suddenly i got an error when i will run the code that is


run time error 5


invalid procedure call or argument


my code is

[pre]
Code:
Private Sub CommandButton1_Click()

pdfName = ActiveSheet.Range("A1")
ChDir "C:temp" 'This is where youo set a defult file path.
fileSaveName = Application.GetSaveAsFilename(pdfName, _
fileFilter:="PDF Files (*.pdf), *.pdf")
If fileSaveName <> False Then
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
fileSaveName _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
End If
MsgBox "File Saved to" & " " & fileSaveName
End Sub
[/pre]

kindly suggest why it's happen


Thanks


SP
 
Hello


forget to tell one more thing that is recently i format my system and i reload the all Adobe software but the code is not working


Kindly suggest what is mistake


Thanks


SP
 
Good day sgmpatnaik


I have used your code and it does as it should saves the file to a PDF, no problem, so It must be some thing at your end?
 
@Bobhc


Hi


wow after long time i got suggest from you,


Thanks for your response and i got one run time error 5 invalid procedure or argument and when i press the Debug button then error display in the below code

[pre]
Code:
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
fileSaveName _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=True
[/pre]

i can't understand why it's displaying i think i have to set some objects in reference but i don't know which object to set if possible please guide me


Thanks


SP
 
sgmpatnaik


I have run your code as a module and in the sheet, I F8 the code, it asks for a name and save directory it saves and then popup say where it has saved too and then the saved PDF file opens. I do not get any errors so I have nothing to debug. I do not know why you are getting errors. Is it due to the reinstall of your PDF software?
 
@Bobhc


Hi,


Thanks for your guidelines and you are correct may be i miss some Adobe software which was first installed in my system and when i format and reinstall the windows then i forget to install the Adobe software which is support to that code


with your kind permission i can show my system with Team Viewer


and one more thing if you have a Adobe software in your system then please give me the software and let me try with the adobe software


Thanks


SP
 
sgmpatnaik


The software I have at work is a fully paid licence, I can not let you have this, you can download a trial from Adobes web site and if that solves the problem get your company to pay for it.
 
Hi patnaik!


Please download below EXE..


I think.. below EXE is missing.. in your system..


http://www.microsoft.com/en-in/download/details.aspx?id=7


Regards,

Deb
 
@Debraj Roy


Hi


Thanks for your replay exactly what i tried you gave me the link thanks and it's working great


cheers


Thanks


SP
 
Good day Debraj Roy


I have never used 2007 and did no realise you needed an addon, never come across this problem in 2010/2013. Nice answer
 
Hi SP!


Thanks for the feedback..


@ bobhc..


I am already experienced it in my life.. :)


Regards,

Deb
 
Back
Top