Hi guys,
I have this macro and i want to save the report as pdf not as doc or docx.
How can i customize my macro in order to save the file as pdf?
Please Login or Register to view this content.
Thank you in advance,
Ionut
Hi guys,
I have this macro and i want to save the report as pdf not as doc or docx.
How can i customize my macro in order to save the file as pdf?
Please Login or Register to view this content.
Thank you in advance,
Ionut
This is how VBA expects the information
Tailor your code as followsPlease Login or Register to view this content.
Amend
toPlease Login or Register to view this content.
amendPlease Login or Register to view this content.
toPlease Login or Register to view this content.
You do not need to distinguish between doc and docx and so you can remove both IF conditionsPlease Login or Register to view this content.
If a response has helped then please consider rating it by clicking on *Add Reputation below the post
When your issue has been resolved don't forget to mark the thread SOLVED (click Thread Tools at top of thread)
Hi Kevin,
Is working properly. Thank you for your help. I had to change the wdExportFormatPDF to 17.
The line .ActiveDocument.Close is making problems now. I receive an open dialog box in order to save the doc when that line is executed and if i close the dialog box it seems that I have the error run tim error 4198.
If you can help, I would owe you.
Thanks,
Ionut
Last edited by IonutC; 04-20-2016 at 02:58 AM.
I suspect that it is because you are now saving as pdf and the instruction to close is not running because the original word document has not been saved
If you do not want to save the Word document then amend the line to
If you do want to save the word document then go back to your original code and insert the new code in the line immediately abovePlease Login or Register to view this content.
New code:Please Login or Register to view this content.
It will run this code first and create the pdf, and then re-use the same variables with the correct values for saving as word documentPlease Login or Register to view this content.
Hi Kevin,
The code looks like this now.
Please see below.
If I move the close phrase above the saving as pdf the macro can't save the report as pdf, or I am wrong?
Please Login or Register to view this content.
Thank you,
Ionut
I think our replies crossed in the "ether". Look at post#4
I see you're also carrying on the same discussion in this thread: http://www.excelforum.com/excel-prog...ose-error.html
Please read the Duplicate Thread policy in rule #5: http://www.excelforum.com/forum-rule...rum-rules.html
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Hi Kevin,
I tried and it seems that is not working like this also.
Kr,
Ionut
Hi Kevin,
The error was due to the fact that i had a comma:
and corrected versions was:Please Login or Register to view this content.
thank you for all your help!Please Login or Register to view this content.
Ionut
No problem
- and next time own up if you have cross posted - members here are active on several sites!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks