Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VBA and Print as PDF Options

Posted on 2004-09-21
6
Medium Priority
?
819 Views
Last Modified: 2007-12-19
we have WIN2K; Adobe Reader/Write Software (adobe pfd writer, adobe pdf destiller) on our computers. I Want to set the PDF Printer Options via some lines of Code in an VBA script.

I need to change the Directory where to write the PDF file,
Paper direction, Image compression options, Paper size via VBA (from Power Point)

Currect Code goes like this ....

' ********************************************************
    ' (4)   Start Printing of the PowerPoint File as PDF
    ' Question 1:  I want to set the PDF printer parameter
    ' Question 2:  I want to set the PDF output directory
    ' ********************************************************
           
    With ActivePresentation.PrintOptions
        ' .RangeType = ppPrintAll
        .NumberOfCopies = 1
        .Collate = msoTrue
        .OutputType = ppPrintOutputSlides
        .PrintHiddenSlides = msoTrue
        .PrintColorType = ppPrintColor
        .FitToPage = msoTrue
        .FrameSlides = msoFalse
        .ActivePrinter = "Acrobat Distiller"
        .PrintInBackground = False
        .RangeType = ppPrintSlideRange
        ' With .Ranges
            ' ********************************
            '  Options which pages to print ...
            '  1, 11 acc. this sample,
            '  pls. Change acc. your needs
            ' ********************************
            ' .Add 1, 11
       
        End With
    ActivePresentation.PrintOut From:=1, To:=11, Copies:=1, Collate:=False
 
 
0
Comment
Question by:BdLm
  • 3
6 Comments
 
LVL 19

Expert Comment

by:Arno Koster
ID: 12111458
I don't know IF you could supply a directory in which the pdf files will be created in vba, but I know a way to do the trick using batch files.

it's a little bit far off to call batch files by vba but it does work...
0
 
LVL 16

Expert Comment

by:jimbobmcgee
ID: 12111533
Alternatively, if you know where the file is saved, you can use the File System Object to move it after it has been created...
0
 
LVL 16

Accepted Solution

by:
jimbobmcgee earned 300 total points
ID: 12111557
Otherwise, the following link
     http://www.microsoft.com/AccessDev/Articles/GetzCh10.HTM

has a good all-round view of the printer system for Office.  It's written with Access in mind but I'm sure some of the concepts are still valid...
0
 
LVL 8

Author Comment

by:BdLm
ID: 12563693
proposal:

i checked the Comment from jimbobmcgee, interessting link,
but I could not find the pdf specific
printer parameters, I think only one from adobe can help here?

Do I have some misunderstanding?
 
as jimbobmcgee made some efforts i propopse to give him the points, but file the solution as not solved.
0
 
LVL 16

Expert Comment

by:jimbobmcgee
ID: 12812700
I imagine you would need to configure the page setup (paper size, orientation, etc) and printer (to Acrobat Distiller), as per the link, then send to the Acrobat Distiller to create the PDF.  I doubt the Acrobat Distiller can be configured via VBA, although, you may be able to send text to a window/dialog that the Distiller produces, using SendMessage API.

You might like to ask one of the more subclass-mided Experts here about hooking the Distiller dialog...

Thanks for the points.

J.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question