Merge PDFs into single document using VBA

  • Hello I am new to this group and was wondering if anyone could help me with how to merge multiple pdf files in single file using VBA macro.
    I have to create a final Pdf file that has all the different reports in it and i get individual reports in pdf format from different teams. I am using pdf creator version 2.3.2. I found the code online but it throws an error
    when the code reaches .MergeAllJobs it throws an error saying Run time error and " The queue must not be empty". the test file i am testing does exists in those location that i mentioned in the code. below s the code for your reference.

    appreciate all the help guys.


  • Re: Pdf merging

    Are you just starting out trying to use PDF Creator 2.3.2? Only help I can offer is that I was never able to successfully use PDF Creator 2.3.2 in VBA.
    I'm stuck on 1.7.3 - fortunately that suits my needs.
    I believe 1.7.3 is still available for download but I don't know if it supports the functions you are using.
    Good luck

  • Re: Pdf merging

    I am currently using VBA code to print excel sheets to pdf reports from pdf creator. its working fine with 2.3.2 version.
    But i am not able to merge the pdf files in 2.3.2 as it throws error. do you have any alternate ways of merging pdf's using vba.

  • Re: Pdf merging

    Sorry I don't.
    Please tell me: what version of Excel you are on. I'm on 2016 via Office 365 but 2.3.2 did not work when I was on Excel 2010 either.
    Just curious - maybe I have to try harder!

  • Re: Pdf merging

    I am using excel 2013 and printing excel sheets works nicely through pdf creator. if you search online you can find code for printing of excel sheet through pdf creator.

  • Re: Pdf merging

    Acrobat, not reader, would be the better 3rd party method. PDFsam is not bad.

    For the newer version, this seemed to work, somewhat. It is slower than the older version of pdfcreator.

  • Re: Pdf merging

    Hello Kenneth,

    Thanks for the reply.
    But unfortunately i still have the error. I see the code you posted is same that i used.
    at .MergeAllJobs i get an run time error and it says "queue must not be empty".
    any thoughts on what could be the reason. i am using 2 files temp1 and temp2 for testing and they exist in the mentioned folder as well and are not password protected.

    appreciate your help on this.


  • Re: Merge PDFs into single document using VBA

    i tried to debug and check it but it seems PDFCreator.Queue is empty and is not accepting the jobs don't know if its a data type issue. I have limited skill set in VBA. so I may be wrong.

  • Re: Merge PDFs into single document using VBA

    I added some more error checks and features. I used a 5 second wait. That can probably be less.

  • Re: Merge PDFs into single document using VBA

    I don't know how to tell this, but you are nothing short of a Legend.
    Thanks a lot. Its working perfectly.

    I have a dynamic no of PDF files that I need to merge and it varies for each report. Your help has been great.
    And to be frank your posts on this and other forums have helped me learn a lot in VBA.

    Thanks a lot again.


  • Re: Merge PDFs into single document using VBA

    Thanks for the flowers.

    I had created the first example some time back but something changed and it no longer worked. Your post prompted me to look at it again. I learned something along the way which is another reason why I like to help people.

    Ken Puls posted some great examples for the older version which has helped many.

    I had used VBA to run PDFsam some years back and Acrobat for those that have it and not just the reader. It is nice to see that PDFCreator 2.3.2 now works well too.

  • Quick 2019 update - this method still works in PDFCreator 3.5.1. A slight modification is required as the VBA Library name has changed. My working code is below.

  • Good Day - i have downloaded and installed PdfCreator 3.4.1 and am attempting to run the code above from HE. i get a compile error at line 24 - "user-defined type not defined". I see that line 24 is different in HE's code from K. Hobson's (line 18). Same error with both lines.

    Am i supposed to download & install a COM interface from the web link in the ' COM interface...' line? If so that link isn't working for me and I can't find any COM file to download.

    Can someone please hold my hand here? Thank you to all.

    John M.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!