Batch conversion with Office AddIn by addressing Command Bar

This Forum is for the use of End Users requiring help and assistance for Tracker Software's OFFice2PDF and MS Office Addin Applications - supplied with PDF-XChange.

Moderators: Daniel - PDF-XChange, PDF-XChange Support, Vasyl - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Stefan - PDF-XChange

Post Reply
koch000c
User
Posts: 2
Joined: Wed Jan 16, 2013 2:34 pm

Batch conversion with Office AddIn by addressing Command Bar

Post 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.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19826
Joined: Mon Jan 12, 2009 8:07 am
Contact:

Re: Batch conversion with Office AddIn by addressing Command

Post 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
koch000c
User
Posts: 2
Joined: Wed Jan 16, 2013 2:34 pm

Re: Batch conversion with Office AddIn by addressing Command

Post 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?
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19826
Joined: Mon Jan 12, 2009 8:07 am
Contact:

Re: Batch conversion with Office AddIn by addressing Command

Post 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
wolfgang_1234
User
Posts: 2
Joined: Wed Oct 23, 2013 8:34 am

Re: Batch conversion with Office AddIn by addressing Command

Post 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
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19826
Joined: Mon Jan 12, 2009 8:07 am
Contact:

Re: Batch conversion with Office AddIn by addressing Command

Post 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
wolfgang_1234
User
Posts: 2
Joined: Wed Oct 23, 2013 8:34 am

Re: Batch conversion with Office AddIn by addressing Command

Post 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
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19826
Joined: Mon Jan 12, 2009 8:07 am
Contact:

Re: Batch conversion with Office AddIn by addressing Command

Post 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
Pico
User
Posts: 12
Joined: Mon Nov 18, 2019 10:41 am

Re: Batch conversion with Office AddIn by addressing Command Bar

Post 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?
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 10961
Joined: Wed Jan 03, 2018 6:52 pm

Re: Batch conversion with Office AddIn by addressing Command Bar

Post 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,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Pico
User
Posts: 12
Joined: Mon Nov 18, 2019 10:41 am

Re: Batch conversion with Office AddIn by addressing Command Bar

Post 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:
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 10961
Joined: Wed Jan 03, 2018 6:52 pm

Re: Batch conversion with Office AddIn by addressing Command Bar

Post 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,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Pico
User
Posts: 12
Joined: Mon Nov 18, 2019 10:41 am

Re: Batch conversion with Office AddIn by addressing Command Bar

Post 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
Pico
User
Posts: 12
Joined: Mon Nov 18, 2019 10:41 am

Re: Batch conversion with Office AddIn by addressing Command Bar

Post by Pico »

viewtopic.php?t=30958

Seems as if the developement is not really interested.
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 10961
Joined: Wed Jan 03, 2018 6:52 pm

Re: Batch conversion with Office AddIn by addressing Command Bar

Post 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,
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Pico
User
Posts: 12
Joined: Mon Nov 18, 2019 10:41 am

Re: Batch conversion with Office AddIn by addressing Command Bar

Post 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
Pico
User
Posts: 12
Joined: Mon Nov 18, 2019 10:41 am

Re: Batch conversion with Office AddIn by addressing Command Bar

Post by Pico »

I found a solution. Thanx :)
User avatar
Daniel - PDF-XChange
Site Admin
Posts: 10961
Joined: Wed Jan 03, 2018 6:52 pm

Batch conversion with Office AddIn by addressing Command Bar

Post by Daniel - PDF-XChange »

:)
Dan McIntyre - Support Technician
PDF-XChange Co. LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Post Reply