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

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:tempPPTToProcess' strSourceFile = Dir(
strSourcePath + '*.PPT') strWatchInPath = 'c:MyWatchedFolderin'
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

You May Also Like

About the Author: Planet PDF Team

Leave a Reply