Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General PowerPoint Questions / November 2007

Tip: Looking for answers? Try searching our database.

PowerPoint "ExportAsFixedFormat" for saving PPT as PDF in VBS

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Birke - 14 Aug 2007 08:46 GMT
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.
Steve Rindsberg - 16 Aug 2007 04:40 GMT
I'm not a VBS user but I think perhaps it doesn't allow strongly typed variables and constants?

PowerPoint is expecting a Long for ppFixedFormatTypePDF
I'm guessing that it's getting a variant instead.
Is there any way of forcing VBS to pass a long?

> hi @ all,
>
[quoted text clipped - 54 lines]
>
> thx for any helpfull hint or solution.

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
Birke - 20 Aug 2007 10:00 GMT
i tried this with a clng() statement but it didn't affect ... there is still
the same problem :(
does anyone has an idea?

> I'm not a VBS user but I think perhaps it doesn't allow strongly typed variables and constants?
>
> PowerPoint is expecting a Long for ppFixedFormatTypePDF
> I'm guessing that it's getting a variant instead.
> Is there any way of forcing VBS to pass a long?
Steve Rindsberg - 21 Aug 2007 17:53 GMT
> i tried this with a clng() statement but it didn't affect ... there is still
> the same problem :(
> does anyone has an idea?

I don't, but I'm betting if you post the question to a VBS newsgroup, someone will have run across
the same problem and solved it (maybe with a different app than PPT but the same solution should
apply here as well).

> > I'm not a VBS user but I think perhaps it doesn't allow strongly typed variables and constants?
> >
> > PowerPoint is expecting a Long for ppFixedFormatTypePDF
> > I'm guessing that it's getting a variant instead.
> > Is there any way of forcing VBS to pass a long?

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
Chris Priest - 15 Nov 2007 13:59 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.