PDF In-Depth

IAC - How to convert all the PPTs in a folder to PDF

May 22, 1999

Advertisement
Advertisement
 

How to convert all the PPTs in a folder to PDF

This code sample is posted here for the general benefit of the PDF development community. Attribution and usage guidelines are as noted in the code source; please respect the wishes of the author when using this code.


Option
 Explicit' Author : Planet PDF
' E-mail : info@debenu.com
' Date : 10 March 1999
' URL : http://www.planetpdf.com/
' Version : 1.0
' Description: This is a simple demonstration of how all PPT
' files in a given folder can be converted to PDFs.

Private
 Sub
 btnConvertAllPPT_Click(
)
    Dim
 msPPT As
 PowerPoint.
Application
    Set
 msPPT = CreateObject(
"PowerPoint.Application.8")    
    Dim
 strSourceFile As
 String    Dim
 strDestinationFile As
 String    Dim
 strSourcePath As
 String    Dim
 strWatchInPath As
 String    
    strSourcePath = "c:\temp\PPTToProcess\"    strSourceFile = Dir(
strSourcePath + "*.PPT")    strWatchInPath = "c:\MyWatchedFolder\in\"    
    msPPT.
Visible = True    
' Iterate through each file in the folder
    While
 strSourceFile <> ""        
    ' Your default printer needs to be have a postscript printer
    ' driver for this to work - you could set and reset the
    ' default printer if you preferred
    
    ' Open the PPT
        msPPT.
Presentations.
Open
 strSourcePath + strSourceFile
    
    ' Format the destination filename
        strDestinationFile = strWatchInPath + Left(
strSourceFile,
 _
                                    Len
(
strSourceFile)
 - 4)
 + ".ps"        
    ' Print the PPT to a PS file in the watched folder
        msPPT.
ActivePresentation.
PrintOut _
                    PrintToFile:=strDestinationFile
        
    ' Grab the next file for processing
        strSourceFile = Dir
        
    Wend
' Cleanup
    Set
 msPPT = Nothing    
' You'll need to close PPT by yourself and wait for
' the background printing to stop
    
End
 Sub

(ARTS PDF and Planet PDF have been since acquired by Debenu)

PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Quick PDF Library

Get products to market faster with this amazing PDF developer SDK. Over 900 functions and an equally...

Download free demo

Back to the past, 15 years ago! Open Publish 2002

Looking back to 2002, it's amazing how much of the prediction became a reality. Take a read and see what you think!

September 14, 2017
Platinum Sponsor





Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.

Features

Adding a PDF Stamp Comment

OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.