Page 1 of 1

Batch conversion with Office AddIn by addressing Command Bar

Posted: Wed Jan 16, 2013 3:44 pm
by koch000c
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.

Re: Batch conversion with Office AddIn by addressing Command

Posted: Wed Jan 16, 2013 4:27 pm
by Tracker Supp-Stefan
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

Re: Batch conversion with Office AddIn by addressing Command

Posted: Wed Jan 16, 2013 4:46 pm
by koch000c
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?

Re: Batch conversion with Office AddIn by addressing Command

Posted: Wed Jan 16, 2013 5:06 pm
by Tracker Supp-Stefan
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

Re: Batch conversion with Office AddIn by addressing Command

Posted: Wed Oct 23, 2013 8:39 am
by wolfgang_1234
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

Re: Batch conversion with Office AddIn by addressing Command

Posted: Thu Oct 24, 2013 3:41 pm
by Tracker Supp-Stefan
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

Re: Batch conversion with Office AddIn by addressing Command

Posted: Thu Oct 24, 2013 4:22 pm
by wolfgang_1234
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

Re: Batch conversion with Office AddIn by addressing Command

Posted: Fri Oct 25, 2013 1:40 pm
by Tracker Supp-Stefan
Hi Wolfgang,

Sorry to hear that Office2PDF is not suitable and hope you will manage to get the scripts you need.

Regards,
Stefan