Adobe and Word RRS feed

  • Question

  • The individuals in my organization, throughout the day, need to save a word document as a pdf and combine it with another pdf before saving and printing.  The word documents and adobe documents will always have varying names.  We have Word 2007 and Adobe Acrobat Pro.  I've written a number of macros to simplify various tasks.  Word has a command where you can save as a pdf and perform an action, but combining documents is not one of the actions.  Please help.  After a few thousand lines of code, this is the last thing I have to do.  Thank you.

    David Carson

    Wednesday, August 12, 2015 11:47 PM

All replies

  • I know of 2 ways to do it.  PDFCreator allows you to merge ps files.  You print the Word doc which creates the .ps file then merge files.  I have never used it with VBA.  It has a com interface. There is VBScript example that you'll need to convert to VBA:

    c:\program files\pdfcreator\com\windows scripting host\vbscripts\combinejobs.vbs

    The best method in my opinion is to use ghostscript to merge pdf files.  Your command will look something like this:

    gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=finished.pdf myFiles*.pdf

    You will need to call this with Wscript so you will block while it runs.

    Thursday, August 13, 2015 12:37 AM
  • Sadly I don't have PDFCreator, and can't install it because of company restrictions.The other option is a little above my skills.  (Sorry)  I'm all self taught.  I initially tried to send a command to open Acrobat Pro, then use "sendkeys" to start the "combine" command.  Unfortunately, I could not get it to work.

    I was really hoping that I could use some variation of the "save as pdf and perform an action" command.

    I apologize for not being more knowledgable.

    Thursday, August 13, 2015 2:02 AM
  • I think you'll need Adobe Acrobat to do what you want to do.  It's around $120.  Check this out.

    This looks good too.

    Does that help?

    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

    Thursday, August 13, 2015 1:56 PM
  • I have Acrobat XI Pro.  The problem with that code is it assumes that the file names are already known.  I would need to use a FilePicker to identify the files to be merged.
    Thursday, August 13, 2015 11:11 PM
  • Oh, I didn't know you're doing it like that.  Please see this link.  This describes how to select a file using the InputBox.

    Once you select your 2 files, and pass the 2 values to 2 variables, use those variables in your code.  That should work just fine.

    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

    Friday, August 14, 2015 12:51 AM