Hi, I am trying to create VBA code which opens a powerpoint application, runs a specific powerpoint slideshow, then closes the slideshow, but leaves powerpoint open in the background. The code I have so far is:
Dim PPApp As Object
Set PPApp = CreateObject("Powerpoint.Application")
PPApp.Visible = True
PPApp.Presentations.Open ThisWorkbook.Path & VideoName
Application.Wait (Now + TimeValue(Delay))
PPApp.Presentations.Close
This works, but it closes the powerpoint application, not only the slide show.
I have also tried this code:
Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide
' Reference instance of PowerPoint
On Error Resume Next
' Check whether PowerPoint is running
Set PPApp = GetObject(, "PowerPoint.Application")
If PPApp Is Nothing Then
' PowerPoint is not running, create new instance
Set PPApp = CreateObject("PowerPoint.Application")
' For automation to work, PowerPoint must be visible
PPApp.Visible = True
End If
On Error GoTo 0
PPPres.Presentations.Open ThisWorkbook.Path & VideoName
Application.Wait (Now + TimeValue(Delay))
PPPres.Close
This doesn't even start the slide show as I get a "Compile error: User defined type not defined" for
Dim PPApp As PowerPoint.Application
I have also tried combining elements of the two like this:
Dim PPApp As Object
Dim PPPres As Object
Set PPApp = CreateObject("Powerpoint.Application")
Set PPPres = PPApp.Presentations
PPApp.Visible = True
PPPres.Open ThisWorkbook.Path & VideoName
Application.Wait (Now + TimeValue(Delay))
PPPres.Close
This opens and runs, but will not close, as I get the error
Run-time error '438': Object doesn't support this property or method
For the "PPPres.Close" command. I have also tries "PPPres.Presentations.Close" and:
With PPPres
.Close
End With
but all with the same result. I can't think of any alternatives myself, so I need some genius help here.
Any help with this will be greatly appreciated! 
Christopher
Bookmarks