Solved

VBA and Print as PDF Options

Posted on 2004-09-21
6
803 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

776 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