Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Powerpoint Quit Event

Status
Not open for further replies.

JohnnyLong

Programmer
Sep 27, 2002
97
GB
I'm controlling Powerpoint from VB6. When a user quits the Powerpoint presentation I want to Quit the Powerpoint app as well. Here is some sample code that doesn't work. Any ideas? Similar code works for Word & Excel.

Private Sub objPowerPoint_PresentationClose(ByVal Pres As PowerPoint.Presentation)
On Error GoTo Err_objPowerpoint_PresentationClose

If objPres.Saved = msoFalse Then
intresponse = MsgBox("Do you want to save changes to the presentation?", vbYesNo + vbMsgBoxSetForeground + vbQuestion, "Save Changes?")
If intresponse = vbYes Then
objPres.Save
Else
objPres.Saved = msofalse
End If
End If

strWordCaption = ""
GoTo Exit_objPowerpoint_PresentationClose

Err_objPowerpoint_PresentationClose:
Call ShowError(CStr(Err), Error$, CStr(Me.Name), "objPowerpoint_PresentationClose", "")
Resume Exit_objPowerpoint_PresentationClose

Exit_objPowerpoint_PresentationClose:

Call PptQuit
Set objPres = Nothing
Set objPowerPoint = Nothing

End Sub

Private Sub PptQuit()
If IsObject(objPowerPoint) Then
objPowerPoint.Quit
End If
End Sub
 
powerpoint.application.quit
might work for you...

Just an idea... (and it might be spelled wrong:))

--James
junior1544@jmjpc.net
Life is change. To deny change is to deny life.
 
Thanks for the reply Junior, but I'm getting an "ActiveX component can't create object" error. ObjPowerpoint is dimmed WithEvents. PresentationClose is triggered, but I'm guessing I can't call Application.Quit from within the same sub as the presentation isn't actually closed until exiting PresentationClose. I think I need to quit powerpoint once the PresentationClose event has completed. Maybe PresentationClose is the wrong event. Any ideas?
 
Dear JohnnyLong,

I have the same problem here, you found a solution yet?

Hoping for help,

Tom
 
here's another thought... put this justbefor the call pptquit

objPowerPoint.quit

I have some code that manipulates power point files and would be happy to post it if you'd like... my code is from access 2k, but it might be able to help you...

--James
junior1544@jmjpc.net
Life is change. To deny change is to deny life.
 
Dear Junior,

Could you please send me those files, i'm really interested. My emailadress is t.suter@chello.nl

How can i call objPowerpoint.quit from PHP? I have the following code (which doesn't work):
php:
<?
$instance = new com(&quot;powerpoint.application&quot;);
$instance->Visible = 1;
$instance->Presentations->Open(&quot;c:\\test\\test1.ppt&quot;);
$name = $instance->ActivePresentation->BuiltInDocumentProperties[1]->Value;
$instance->ActivePresentation->Close();
$instance->Quit();
?>

Everything works, except the last instance->Quit();
 
With PHP i have no idea... this forum is for vba, not php... I'm sorry but i know nothing of PHP... I'd be happy to send the mdb i have that can control power point a bit... it'll be on it's way shortly...

--James junior1544@jmjpc.net
Life is change. To deny change is to deny life.
 
I know this is a VBA board, I posted here, because I thought te problem was VBA and not PHP related. Thanks for your files. I check them out. I'll let you know if they were a help for me.
 
I have the same problem with PowerPoint in VB.NET, did you find a solution??
 
I never did solve this problem in VB6 and now we are redeveloping using VB.Net. Did anyone find a resolution?
 
Here is an off the wall suggestion:

Since you only want the presentation to be displayed and you don't want to do anything in PowerPont directly, why not save an instance of the presentation as a .pps and then run the .pps file from your VB6 app.

This is a presentation that runs by itself and closes as soon as the presentation is over. The presentation will run with out having to even start PowerPoint or even having it installed!

Since the .pps file doesn't need PowerPoint to run, there is no real reason to worry about closing PowerPoint at all.

I hope this is a possible solution!



Peace! [peace]

Mike

Never say Never!!!
Nothing is impossible!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top