Reputation: 1377
I have found several articles (all along the same lines) to use Adobe Acrobat to merge PDF's from VBA, in my case MSAccess
When I get to this
Set objCAcroDoc = CreateObject("AcroExch.PDDoc")
I get this error "No such interface supported"
I'm using Adobe Acrobat DC which I have reinstalled a few times (was one of the suggested fixes), but I still can't get past this error, any help would be very much appreciated. Has anyone else seen this before
These are a couple, of the many, examples I've looked at and used (tried to)
Merging multiple PDFs to Single PDF using VBA
VBA, Combine PDFs into one PDF file
Upvotes: 1
Views: 3213
Reputation: 49274
Ok, first up, your 3 examples are for Adobe Acrobat - the paid version and NOT the free adobe DC reader which you seem to be using here.
However, you can try my code here:
It does NOT require adobe, and it does not even require a install to the target computer of special software. There are 3 tiny .dll's you have to include, but they do not require "installing", but ONLY that you place them in the same folder as where your access accDB file is running from.
Code to thus merge pdf' looks like this:
Dim MyPdf As Object
Set MyPdf = CreateObjectNET("Pmerge.dll", "Pmerge.Pmerge")
MyPdf.Add CurrentProject.Path & "\a.pdf"
MyPdf.Add CurrentProject.Path & "\b.pdf"
' set output file to merge above list to
MyPdf.OutPutDoc = CurrentProject.Path & "\ab.pdf"
MyPdf.Merge ' merge the files
Debug.Print "done"
So, you just create the pdf object, feed it some files, and set a output file, go merge, and you are done.
In the sample is also a sample form, and it just lets you select the file(s) and merge, but it really does much the same as the above code.
so, the sample form looks like this:
so this is pure VBA code. And this will work on computers even without ANY pdf reader installed.
You can find this sample code of mine here:
http://www.kallal.ca/Articles/Pdf/Merge.html
Anyway, you not at all clear which Adobe product you are using, but the free adobe DC pdf reader DOES NOT have pdf merge abilites. You need to be running the paid version of Adobe acrobat, and not the free DC reader.
However, it really don't matter if the above sample work for you. It does not require anything more then access, and no speical 3rd party tool need be installed for this sample to work.
the other added bonus, is this pdf merge also supports office x64 version, and no code changes are required to run either Access x32, or Access x64 verisons.
Upvotes: 1