PDF File Merging, opening, saving within VBA

  • Thread starter Steve from Maine
  • Start date
S

Steve from Maine

I am developing a DB app in Access 2007 that will maintain parts for an
electrical companies parts/items and print a catalog/report. Everything is
fine however I would like to use the “Included†Adobe/Acrobat/PDF dll
objects(.tlb?) that now come with Access 2007.

I was trying to use CreateObject(“Adobe.applicationâ€) but it doesn’t seem to
like it. As well I am having a lot of trouble finding sample code showing me
the proper way to address the object.


What I want to do:

My catalog has 3 Access reports(2 separate index reports and then 1 report
for the items(repeating report by section) + PDF images for each section.
(After printing the two index reports, I have written a routine to print 1
sections parts followed by an image or images(pdf) that I store the
path+filename to in the database. Then I loop back and do the next section.
This all works fine but even if I make adobePDF as my default printer. It
still makes separate files.(As well, I don’t know how to print out the PDF
files from VBA). I do know how to createobject(Word.Application) and print
word docs and would think I could do this with Adobe/PDF but likeI said
above, it doesn’t seem to like CreateObject(“Adobe.Applicationâ€) or
“createobject(“PDF.Application) or createObject(“AcroExch.Appâ€).

***** What I really would like to do *********
I would really like to open up 1 pdf file, write/append the two index
reports to it, leave it open and write/Append each section report + images to
it so I end up with one PDF file. (1 big parts catalog PDF file)

Don’t see any Merge actions with the CreateObject(“AcroExch.Appâ€) method.

I am usually pretty good about figuring out this stuff on my own but I can
find what the methods and properties are for this “Adobe†object that
supposedly comes with 2007.

Can you help?


Thanks

Steve from Maine
 
A

Albert D. Kallal

I'm not sure where you got the idea that the access built in PDF creating
abilities in access has anything to do with Adobe, or some set of dll files.

The PDF system in access simply allows you to save an report as an PDF file.
The ability eliminates the need for installing Adobe, eliminates the need
for setting up a pdf printer. You don't need any 3rd party files.

You can now simply send a report to a pdf file.

you can use:

DoCmd.OutputTo acOutputReport, "faxbook", acFormatPDF, "c:\mypdf.pdf"

Notice how it is only one line of code to save an report as an PDF file. No
printer drivers are needed, no references to Adobe, no create object code,
no reference to some "dll", no need to even switch printers.

So the built in PDF system saves an enormous amount of coding and an
enormous amount of work. However that pdf system has nothing to do with all
the create object and weird strange and bizarre references you talked about
in your post.
I was trying to use CreateObject("Adobe.application") but it doesn't seem
to
like it. As well I am having a lot of trouble finding sample code showing
me
the proper way to address the object.

as mentioned you don't need to reference the object or do anything at all to
say the report as a PDF file.

What all in the above means is that you need to develop a solution that
allows you to ease create a report in Access with the correct formatting.
You then add the above ONE LINE of simple code to save that report as an PDF
file...
I have written a routine to print 1
sections parts followed by an image or images(pdf) that I store the
path+filename to in the database.

It not quite clear how the above works, but as mentioned the simplest and
easiest solution here is to get your report formatted and working the way
you want, then simply use the above one line of code that is output as a PDA
a file.
As well, I don't know how to print out the PDF
files from VBA

If you build the report inside of MS access, then why not just print the
report?

It is not quite clear why you're messing around with all of the PDF stuff at
first. you are a lot better off to try and get as mentioned the report
working in access natively first, and ignore all that PD of stuff if you
can.

If you're actually going to do manipulation of the actual PDF documents
themselves, then the built in PDF stuff in ms-access is of no use, and I
think you would be better to look at the Adobe site for more inforaton.
However the Adobe documentation assumes that you've purchased and are
working with the development tools and systems available from Adobe systems,
not the ms-access ones. last time I looked they were quite expensive.
***** What I really would like to do *********
I would really like to open up 1 pdf file, write/append the two index
reports to it, leave it open and write/Append each section report + images
to
it so I end up with one PDF file. (1 big parts catalog PDF file)

If you are going to start mixing and matching and slicing and dicing PDF
files, then you're not really using the features of MS access anymore. I
would strongly suggest you come up with a solution that works natively 100%
in a report, and thus don't use PDF files. You then simply generate the
report the way you want, and then use the ability of access to save the
report as an PDF file. If you don't use this approach, then you're going to
have to read up on using the PDF documentation and install some 3rd party
pdf system. That system will thus also have to be installed and setup on any
machine that will run this software. And, worse you you're likely to find
little help here for that 3rd party system. However, you certainly could ask
around in the Adbobe support forms if it worth purcharhing their pdf system.
See what kind of help you get there...

Stephan Labens does have an access soltion that allows concatenation or the
ability to merge more than one PDA file together, you could perhaps try that
(you're introducing third party software into your solution if you do this).
However, this soltion does not require an actual printer driver nor
installation, but you do have to place stephans software in the same dir as
your applicaion. His soltuion is here:
http://www.lebans.com/reporttopdf.htm

Another system that allow you to take several PDS documents, and join them
together into one PDF file is the open source PF creation system here:

Open souce:
http://sourceforge.net/projects/pdfcreator/

The above can be scripted and automated from ms-access. Thus again this
would save you the purchase of the Adobe pdf system.

As I said, if you want to introduce 3rd party software then you be spending
time in other support forms (such as the sourceforge one, or the Adobe pdf
one). I think you're better off to try and come up with a solution that
allows you to generate the report the way you want and then simply use the
new access built ability to save the report as an PDF file.

If you need to manipulate the pdf files directly, then the built in PDF
ability in access is absolutely of use to you. The pdf system in ms-access
simply allows you to email or save an report as an pdf file, nothing more,
nothing less.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top