How do I 'Trap' Application Close Event?

I

Ian47

I am using Powerpoint 2003.

Is it possible to 'Trap' the Application Close Event which occurs when you
click on the Windows Close 'Red and White Cross' Icon?

I need to execute some code to save all open presentations before the
application closes to avoid being prompted to 'Save Changes?'

I have tried numerous approaches including Event Handling on SlideShowEnd,
PresentaionClose, Windows Deactivate, PresentationBeforeSave and the
AutoEvent AddIn freeware by Shyam Pillai.

None of these event handler procedures seem to occur before the 'Save
Changes' prompt appears.

Am I trying to achieve the impossible?

Any help welcome

Ian
 
I

Ian47

Shyam,

Once again, your response was as quick as ever and answered my question.
Thank you!!!

I have used Chirag's SubClassPowerpoint Addin and it works a treat.

One extra bit I would like to achieve if possible is to offer the user a Yes
No option to continue / cancel on clicking the close Icon.

I have tried unsuccessfully to modify Chirag's code by adding the following
MsgBox Option:

If wParam = SC_CLOSE Then

Response = MsgBox("Are you sue you wish to quit?",
vbExclamation + vbYesNo, "Quit?")

If Response = 6 Then ' Yes Clicked

ExitProcess (0) ' Exit Powerpoint

End If
End If

Whilst this works a treat if you now close Powerpoint by clicking on the
Close Icon,
If you close by clicking on File- Exit or use Application.Quit code, it
triggers a "Powerpoint has encountered a serious error and must close" error
message.

As I am not completely sure what I was doing when modifing the Subclass
code, I wonder if either you or Chirag could give me some guidance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top