PowerPoint "ExportAsFixedFormat" for saving PPT as PDF in VBS

B

Birke

hi @ all,

i downloaded the plugin for office 2007 for pdf saving. now i have to frite
an vbs script that take 2 parameters. a source file and a destination file.
the task is that the source ppt is transfered in an pdf (pdfa with iso
standard is the final task).

therefore i use the following vbs procedure:

Function Ppt2PDFA(pptFilePath, pdfFilePath)
'definitions for powerpoint export as pdf/a
Const ppWindowMinimized = 2
Const ppFixedFormatTypePDF = 2
Const ppFixedFormatIntentPrint = 2 '(1 for screen; 2 for print)

Dim ppApplication
Set ppApplication = CreateObject("PowerPoint.Application")
ppApplication.Activate
ppApplication.Presentations.Open (pptFilePath)

'Sub ExportAsFixedFormat(
' Path As String,
' FixedFormatType As PpFixedFormatType,
' [Intent As PpFixedFormatIntent = ppFixedFormatIntentScreen],
' [FrameSlides As MsoTriState],
' [HandoutOrder As PpPrintHandoutOrder = ppPrintHandoutVerticalFirst],
' [OutputType As PpPrintOutputType = ppPrintOutputSlides],
' [PrintHiddenSlides As MsoTriState],
' [PrintRange As PrintRange],
' [RangeType As PpPrintRangeType = ppPrintAll],
' [SlideShowName As String],
' [IncludeDocProperties As Boolean = Falsch],
' [KeepIRMSettings As Boolean = Wahr],
' [DocStructureTags As Boolean = Wahr],
' [BitmapMissingFonts As Boolean = Wahr],
' [UseISO19005_1 As Boolean = Falsch],
' [ExternalExporter])

'=== CRITICAL LINE ===>>
ppApplication.Presentations.Application.ActivePresentation.ExportAsFixedFormat pdfFilePath, ppFixedFormatTypePDF

ppApplication.Quit
End Function

the marked line is the critical line because here o get the following message:


"Laufzeitfehler in Microsoft VBScript: Typen unverträglich:
'ExportAsFixedFormat' "

this means type missmatch for 'ExportAsFixedFormat'. i can make sure that
the first parameter IS a string.

when i try this in VB then i will get a correct result. not this error.

what is the fault ???

thx for any helpfull hint or solution.
 
B

Birke

i tried this with a clng() statement but it didn't affect ... there is still
the same problem :(
does anyone has an idea?
 
C

Chris Priest

I spent ages trying to get this to work.

In the end I looked in the Powerpoint PIA using .Net Reflector and noticed that there is now a ppSaveAsPDF entry in the PpSaveAsFileType enumeration.

I tried this with the Presentation.SaveAs method and it worked! (even though the documentation says to use ExportAsFixedFormat)

EggHeadCafe - .NET Developer Portal of Choice
http://www.eggheadcafe.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top