PowerPoint hide window

Sep 12, 2013 at 6:53 AM

I want to modify an PowerPoint file in background.
PowerPoint.Application powerPointApplication = new PowerPoint.Application();
 powerPointApplication.DisplayAlerts = PpAlertLevel.ppAlertsNone;
            if (Utils.IsFileLocked(filePath)) {
                Utils.MessageBoxError("File (" + filePath + ") is open by a other process or can't write on it.", "POWERPOINT");

PowerPoint.Presentation presentation = powerPointApplication.Presentations.Open(filePath);
But the PowerPoint application open, shows the presentation and close automatically.

If I activate
powerPointApplication.Visible = MsoTriState.msoFalse;  
I get follwoing error "Application.Visible : Invalid request. Hiding the application window is not allowed".

How is it possible to hide the window or don't popup the window!?
Sep 17, 2013 at 11:26 AM
which powerpoint version is it? what i known is ppoint cause crazy errors or do nothing(or bullshit) if its invisible(regardless from the api, NO,VSTO, interop..). but i see these error the first time. its better to let it visible. a dirty trick is to move the window in the invisible area or/and make it as small as possible.
Sep 23, 2013 at 8:56 AM
I use PP 2010.

If I change the size of the window then the size is also small if the user opens it again.

I think minimizing the window is the best workaround...
May 3, 2014 at 2:21 AM
Edited May 3, 2014 at 2:29 AM
FYI, Sebastian you Rock!
Not sure what the differences are, but I had all kinds of issues with visibility etc ...
In my case I had Office 2007 Enterprise installed, however, when I looked at installed programs there were some 2003 components showing up. I was getting the same error as you. I had to uninstall those earlier components and reboot.

I found it by setting visibility to true, it opened the PowerPoint main UI with nothing opened because of the obvious error I kept getting. From that UI I then tried to open my file and it produced an error regarding the file was a newer version and couldn't open. That's what lead me to suspecting the earlier components on my system.

The below link as an FYI and code work fine for me, no visibility issues.

Please see : This link
Imports NetOffice
Imports PowerPoint = NetOffice.PowerPointApi
Imports NetOffice.PowerPointApi.Enums
Imports NetOffice.OfficeApi.Enums

Public Class Form1

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim oPPTApp As PowerPoint.Application
        Dim oPPTPres As PowerPoint.Presentation
        Dim sFileName As String

        oPPTApp = New PowerPoint.Application
        sFileName = "E:\temp\New folder\Report-Template2.pptx"
        oPPTPres = oPPTApp.Presentations.Open(fileName:=sFileName, [readOnly]:=MsoTriState.msoFalse, untitled:=MsoTriState.msoFalse, withWindow:=MsoTriState.msoFalse)
            With oPPTPres
                For Each slide As PowerPoint.Slide In .Slides
                    For SlideIndex = slide.Shapes.Count To 1 Step -1

                        With slide.Shapes(SlideIndex)
                            Dim FolderWithImages = "Z:\temp\New folder\Images1\"
                            If .Type = MsoShapeType.msoLinkedPicture Then
                                If .Name = Dir(FolderWithImages & .Name) Then 'ensures file exists before updating!

                                    .LinkFormat.SourceFullName = FolderWithImages + .Name


                                End If
                            End If

                        End With

            End With

        Catch ex As Exception
        End Try
    End Sub
End Class