Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: PDF VB.NET Powerpoint
I have a program that batch converts MS Word and MS Excel files to PDF’s. The VB program uses ExportasFixedFormat to create the PDF’s which works great. I’ve been asked to change the program so that it also converts MS PowerPoint files. I have gotten everything to work but there is one slight issue. When the program converts a PowerPoint file, PowerPoint displays a small form with a progress bar that shows the publishing progress. I would like to convert the PowerPoint files totally silent. I have tried using SaveAs and it also shows the progress bar. Neither Excel or Word shows the progress bar. Does anyone have any ideas on how to do this?
Module PowerPointToPDF
    Public Function ConvertPowerPointToPDF(ByVal InputFilePath As String, ByVal OutputFilePath As String) As Integer
        Dim Errors As Integer = 0
        Dim PPApplication As ApplicationClass = Nothing
        Dim PPDoc As Presentation = Nothing

            ' Start an instance of PowerPoint
            PPApplication = New ApplicationClass()
            'PPApplication.Visible = True

            ' Open the source document.
            PPDoc = PPApplication.Presentations.Open(InputFilePath, WithWindow:=False)
            PPDoc.SaveAs(OutputFilePath, PpSaveAsFileType.ppSaveAsPDF)
            'PPDoc.ExportAsFixedFormat(OutputFilePath, PpFixedFormatType.ppFixedFormatTypePDF, PpFixedFormatIntent.ppFixedFormatIntentScreen, Microsoft.Office.Core.MsoTriState.msoCTrue, PpPrintHandoutOrder.ppPrintHandoutHorizontalFirst, PpPrintOutputType.ppPrintOutputBuildSlides, Microsoft.Office.Core.MsoTriState.msoFalse, , , , False, False, False, False, False)

        Catch ex As Exception
            Errors = 1
            ' Close and release the Document object.
            If Not PPDoc Is Nothing Then
                PPDoc = Nothing
            End If
            ' Quit PowerPoint and release the ApplicationClass object.
            If Not PPApplication Is Nothing Then
                PPApplication = Nothing
            End If
        End Try
        Return Errors
    End Function
End Module
Posted 1-Jun-12 6:48am
losmac at 1-Jun-12 11:57am
Which version of PP?
Shahpekan at 30-Oct-12 0:03am
why cannot do import ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 495
1 Sergey Alexandrovich Kryukov 429
2 OriginalGriff 360
3 CHill60 280
4 Sascha Lefévre 269
0 Sergey Alexandrovich Kryukov 10,017
1 OriginalGriff 9,495
2 Peter Leow 5,241
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 3,076

Advertise | Privacy | Mobile
Web02 | 2.8.150327.1 | Last Updated 1 Jun 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100