Solved

VBA and Print as PDF Options

Posted on 2004-09-21
6
800 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:akoster
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 100 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

948 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now