Printing in Powerpoint executes App_PresentationClose event code (

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an addin (.ppa file) for Powerpoint which has some
code to respond to the App_PresentationClose event.

Weird thing is that this code is running when I execute
print commands! e.g; Ctrl+P, Toolbar 'Print' button, File-

??

This happens for Powerpoint 2000, 2002/XP & 2003
 
When you print a presentation, the print engine appears to work with a copy
of the presentation. When this copy is closed when the printing ends it
fires the Close Event.
 
When you print a presentation, the print engine appears to work with a copy
of the presentation. When this copy is closed when the printing ends it
fires the Close Event.

So get around it by something like this?

Set a flag in the print event, then in the Close event,

If bPrinting Then
' Don't respond to event but
bPrinting = False ' we're done printing, clear the flag
Else
' Respond to the Close event normally

End if

Do you mind if I add this to the FAQ?
 
Go ahead. Another oddity to note is the hidden presentation that closes
after print has no path.

Will do. I'm adding a page for event handling notes/oddities. We can pop
others in there as they arise.

So because there's no path, you could avoid the flag idea (it was ugly and
nobody loved it anyhow) and instead trap for a pathless presentation in the
Close event. Nice.
 
Thanks guys. The flag check is the workaround I came up with too - but wasn't
100% sure that it was a reliable fix. Will the Close event *always* be fired
after a print event? My initial testing was showing that only the toolbar
Print button caused a close event, but now looks like all printing does. A
bit of uncertainty there, so wasn't sure that this issue came up 100% of the
time?
 
Also, checking for a pathless presentation isn't ideal either - a
presentation that has never been saved will also be pathless.

In my case I'm doing something along the lines of "do you wish to save the
presentation?" so skipping my close code for pathless presentations won't
work.

If I can find some info to assure me that Print actions *always* fire a
Close event, I can go the flag route.

?
 
If I were a bettin' man, I'd bet on it happening whenever you print, but
Shyam's tested this; let's see what he's got to say.
 
Back
Top