Print Directly To PDF

B

Ben

What line of code would I use in word to print a document directly to a PDF
without getting in information form the user. The variables that I would want
to set in code would be:
For the PDF to be saved in the same location as the original document.
I want to set the name of the PDF in code

The name of my PDF printer is: "Adobe PDF"

I just want to put a button on a word document that prints the current to a
PDF storing it in the same location as the original document and with a file
name that I set in code.

Thankyou in advance for your help.
 
J

Jezebel

If you're using Acrobat 6 --

1. Add a reference to AdobePDFMaker to your VBA project.

2. Use the instruction: AdobePDFMaker.ConvertToGelatoPDF

The PDF will have the same name as the Word document, and be put in the same
folder. You can then rename it as you need. To make sure you get no prompts
from Acrobat, a) Make sure the Word document is saved, and b) check that
there is no existing PDF file that will get overwritten.
 
D

David C. Holley

Where can I find more documentation on the AdobePDFMaker object with its
properties & methods?
 
B

Ben

I tried that but it still pops up with the save as dialog for the pdf. I did
exactly what you said added the reference and then used the line:
AdobePDFMaker.ConvertToGelatoPDF

Before I was using the below:

ActivePrinter = "Adobe PDF"
Application.PrintOut

this essentially does the same as you suggested but it does not require the
reference. I just need to be able to convert it to pdf without any use
interaction whilst giving it a name and setting the location for it to
stored. It storing it in the same location as the original document and using
the same name would do fine.

Thank you again.
 
J

Jezebel

You'll get a prompt if the word document has never been saved -- apart from
that, don't know. The method works for me. But it's all undocumented, so
anybody's guess.
 
J

Jezebel

There's no free source of documentation that I know of. You can see the
methods of the object by using Tools > Macros and selecting PDFMaker from
the 'Macros in' dialog. Then experiment :)

Earlier versions of Acrobat had an SDK that you could download for free.
That provided some documentation, some of which is still relevant. But with
Acrobat 6 the SDK is no longer free, and I'm too stingy to pay for it. And
in any case, they're now up to version 7, which is a different kettle of
fish entirely.
 
D

David C. Holley

Just curious becase the question came up a bit ago in the Access
newsgroup and the responses (including mine) dealt with printing to the
designated PDF printer.
 
B

Ben

Now that I have create the doucment that I wanted to and I have started to
let other people use it. I am now finding that some people machines can not
find the referance to: AdobePDFMaker

They have the excat same version and installation of Adobe Acrobat Distiller
6.0. When I go in to add the referance on their computer the AdobePDFMaker
does not come up on the list. How can I force the computer to find the
referance? DO you know where it is located on the C drive so I can add it
manually?

They all seem to have: AdobePDFMakerX but I cannot get the same functions to
work.

Thankyou in advance for your help.
 

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