JohnnyLong
Programmer
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
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