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 Stefan - PDF-XChange
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 Stefan - PDF-XChange
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 Stefan - PDF-XChange
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 Stefan - PDF-XChange
Hi Wolfgang,

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

Regards,
Stefan

Re: Batch conversion with Office AddIn by addressing Command Bar

Posted: Fri Apr 25, 2025 5:14 pm
by Pico
Is it still the same?

No PDF Bookmarks created from the Styles as set in the Settings in Word?
It works manually from Word, but with the Offcie2PDF I don't get Bookmarks.

Is there any solution for it?

Re: Batch conversion with Office AddIn by addressing Command Bar

Posted: Fri Apr 25, 2025 5:36 pm
by Daniel - PDF-XChange
Hello, Pico

The only way to control bookmark creation via the Office2PDF app is through detection of font characteristics:
image.png
This is because Office2PDF is an extension of our printer engine, and so it only has access to the functions that would would see when printing from MS Word, and configuring the printer settings there.

To use extended options with the Standard printer, you will need to process the files one at a time, using the MS Office toolbar addin, which integrates more deeply with the functions of MS Word, to process more data in the PDF generation process, including controls for interpretation of Word's varying text classes:
image(1).png
Kind regards,

Re: Batch conversion with Office AddIn by addressing Command Bar

Posted: Fri Apr 25, 2025 5:53 pm
by Pico
That's disappointing. Especially when the inital questian is over 10 years ago.

If you are not able to use the settings in Word, is there another was to adress the printing with VS or VBA programm?
Just to start the command I start, when I press the button. I cannot clearly realize in the API. Then it would be possible to create a batch tool.

Otherwise I could have stayed with my old Acrobat. :oops:

Re: Batch conversion with Office AddIn by addressing Command Bar

Posted: Fri Apr 25, 2025 6:05 pm
by Daniel - PDF-XChange
Hello, Pico

When printing, Ms Word does not send that information to the printer, as it expects that you are sending the data to a physical device where such details are worthless. The only way to make use of this data, is through plugins that integrate with the office suite, to request it prepare/present specifics to use for the PDF generation process.

Acrobat, may have some special ways around these limitations, due to their historical agreements with Microsoft, but I am afraid that the rest of us are unable to "break in" to the Ms Office code using external apps. There may be ways to use VBA actions through Office itself to accomplish this, but those go well beyond what I can offer assistance with on this end, as you would be looking to control Word, not our software.

If you are using and looking for assistance with our SDK products, it would be best to start a new topic in the SDK section of our forums, so that the Dev team and other SDK users who may have experienced the same issues can comment.

Kind regards,

Re: Batch conversion with Office AddIn by addressing Command Bar

Posted: Fri Apr 25, 2025 7:27 pm
by Pico
Thanks and yes I will ask in the developer Forum.

anyway it is disappointing. It's a obvious advantage and not a big feature, others asked for over 10 years ago.
My mistake to think the Office2Pdf is using the Office settings.
I didn't check it enough and may have wasted 75$ or an additional day of programming.

Have a nice weekend

Re: Batch conversion with Office AddIn by addressing Command Bar

Posted: Fri Apr 25, 2025 8:20 pm
by Pico
viewtopic.php?t=30958

Seems as if the developement is not really interested.

Re: Batch conversion with Office AddIn by addressing Command Bar

Posted: Fri Apr 25, 2025 8:36 pm
by Daniel - PDF-XChange
Hello, Pico

Interest and viability are two different things, unfortunately. It seems that the ticket created back then (RT#4363) is not currently in line for implementation. In most cases, this means that the function has been rejected due to an impossibility in the request.

As I mentioned before, directly interacting with Word's functions as an external application comes with a great deal of limitations, and this seems quite likely to be one of those situations. Thank you for helping me find this ticket however, as now I can raise the topic with them again to see if anything has changed in the years since it was first written.

I will warn against getting your hopes up, but if the team thinks this may now be viable, I will return to let you know.

[Edit]
Ive just heard back from the dev team, surely enough, this is a case of a hard limit with the methods used to get to this information. In order to offer this control anywhere else, we would effectively need to rebuild a number of related systems from the ground up, and in some cases, that could lead to complications in keeping other features intact.
It is something that we hope to do, but it appears to be stalled for now, and is likely not something we will be able to offer for a few years yet.

Kind regards,

Re: Batch conversion with Office AddIn by addressing Command Bar

Posted: Sat Apr 26, 2025 9:18 am
by Pico
Hi Daniel,

I understand.

What I'm thinking about is just starting the Convert to PDF in Word.
What you already do:
  • Word ist running.
  • The document is oben and active for printing.
Why not starting your addin instead of the printing process?
Instaed I have to click manually for aprox 150 Document to create new PDFs with updated objects.

That's what I don't understand.

Best Regards

Re: Batch conversion with Office AddIn by addressing Command Bar

Posted: Sat Apr 26, 2025 10:16 am
by Pico
I found a solution. Thanx :)

Batch conversion with Office AddIn by addressing Command Bar

Posted: Mon Apr 28, 2025 4:50 pm
by Daniel - PDF-XChange
:)