I have frequently the task to execute a batch conversion of about 100 .doc files to pdf. Using the "Office2pdf" tool does not satisfy my needs because specified format templates in the .doc file are not transferred to bookmarks in the .pdf output file. Therefore I use the Office AddIn which works very well. For batch conversion under Word 2003 I used the following code in Visual Basic:
CommandBars("PDF-XChange 4.0").Controls("Umwandeln in PDF").Execute
However, this does no longer work with Word 2010 as there is no longer the CommandBar object "PDF-XChange 4.0", but only a tab within the Ribbon.
Instead I would expect some code as follows to be functional:
CommandBars.ExecuteMso("Umwandeln in PDF")
or
CommandBars.ExecuteMso(Id_No)
Is there still any kind of simple code like that available to address the Office AddIn by VB code? Otherwise last resort to think of would be trying to use some SendKey commands.
Batch conversion with Office AddIn by addressing Command Bar
Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan
- Tracker Supp-Stefan
- Site Admin
- Posts: 17901
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: Batch conversion with Office AddIn by addressing Command
Hello koch000c,
I spoke with one of my colleagues working on the add-in for MS Office, and he told me that the ribbon button ID is:
PDFXC4_CreatePDF
But he can't guarantee that you calling this from VB will work.
Still we would recommend you to try this and see if it works.
Best,
Stefan
I spoke with one of my colleagues working on the add-in for MS Office, and he told me that the ribbon button ID is:
PDFXC4_CreatePDF
But he can't guarantee that you calling this from VB will work.
Still we would recommend you to try this and see if it works.
Best,
Stefan
Re: Batch conversion with Office AddIn by addressing Command
Hello Stefan,
thanks for your quick reply. Unfortunately the code
Application.CommandBars.ExecuteMso("PDFXC4_CreatePDF")
produces the error message "Invalid procedure call or invalid argument". Any other suggestions?
thanks for your quick reply. Unfortunately the code
Application.CommandBars.ExecuteMso("PDFXC4_CreatePDF")
produces the error message "Invalid procedure call or invalid argument". Any other suggestions?
- Tracker Supp-Stefan
- Site Admin
- Posts: 17901
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: Batch conversion with Office AddIn by addressing Command
Hello koch000c,
Just to confirm - are you still using V4 of our standard printing drivers (and the respecitve Office add-in) or is it version 5?
If it's the latter - then the ID name would be different, but if you are at V4 I am afraid that we do not have any further ideas at this moment
Best,
Stefan
Just to confirm - are you still using V4 of our standard printing drivers (and the respecitve Office add-in) or is it version 5?
If it's the latter - then the ID name would be different, but if you are at V4 I am afraid that we do not have any further ideas at this moment
Best,
Stefan
-
- User
- Posts: 2
- Joined: Wed Oct 23, 2013 8:34 am
Re: Batch conversion with Office AddIn by addressing Command
Good afternoon,
I do have exactly the same problem as the previous poster - has there been identified any solution yet?
I would like to execute a simple VBA code that converts all open word documents to PDFs with the settings as set with the ribbon button.
Thank you and kind regards
Wolfgang
I do have exactly the same problem as the previous poster - has there been identified any solution yet?
I would like to execute a simple VBA code that converts all open word documents to PDFs with the settings as set with the ribbon button.
Thank you and kind regards
Wolfgang
- Tracker Supp-Stefan
- Site Admin
- Posts: 17901
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: Batch conversion with Office AddIn by addressing Command
Hi Wolfgang,
I am afraid that we don't have any VBA code samples for automating Word.
Doesn't the Office2PDF tool work correctly for you?
Regards,
Stefan
I am afraid that we don't have any VBA code samples for automating Word.
Doesn't the Office2PDF tool work correctly for you?
Regards,
Stefan
-
- User
- Posts: 2
- Joined: Wed Oct 23, 2013 8:34 am
Re: Batch conversion with Office AddIn by addressing Command
No, unfortunately it does not. The office2pdf tool does not create the bookmarks based on headlines - the autodetect feature is not suitable for the kind of headlines I use. I need to create the PDF with settings which are only available when created from within Word.
Kind regards
Wolfgang
Kind regards
Wolfgang
- Tracker Supp-Stefan
- Site Admin
- Posts: 17901
- Joined: Mon Jan 12, 2009 8:07 am
- Location: London
- Contact:
Re: Batch conversion with Office AddIn by addressing Command
Hi Wolfgang,
Sorry to hear that Office2PDF is not suitable and hope you will manage to get the scripts you need.
Regards,
Stefan
Sorry to hear that Office2PDF is not suitable and hope you will manage to get the scripts you need.
Regards,
Stefan