Application Events in Powerpoint

B

BnB

It seems there's a catch-22 for application events in PowerPoint. If I
understand the documentation correctly, they aren't automatically enabled, so
you have to create the object with events and initialize it. But any event
that would do that automatically would have to rely on an event to run, which
can't be done until after it's been run. The only way I've found to handle
this is to force a button or something to be hit. This is really kludgy,
messes up the graphics, and is bad for a presentation that's going to be
distributed. It certainly shouldn't be the business of, say, some salesguy
out in the field to understand that there's an application object that needs
to be initialized in the presentation.

I feel like I must be missing something, since it makes no sense. It's like
a driving school saying, "You can't learn to drive until you've passed your
driving test," and no one would intentionally set that up. Hence my doubt...

Any thoughts?
Thanks!
BnB
 
T

Tushar Mehta

In PP, the Auto_Open and the complementary Auto_Close events fire
automatically in a *add-in,* i.e., in a .PPA file. You can use them to
do whatever else you want. For more, search www.pptfaq.com for
'auto_open' (w/o the quotes).

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 
B

BnB

Ah, that's a good idea. I'll do that with a MouseOver event and a boolean to
ensure it only runs once. I am trying to do events in a presentation (other
uses don't come to mind, but clearly they exist). It can be used as an
extension to animation. Animation tends to be very time-directional, and
macros can be less so. It wasn't worth doing the whole add-in thing.

I only wish that animation sequences could be triggered by a macro (in this
condition, fire this sequence; in that condition fire a different one), but
there doesn't seem to be any slide-show-time link between macros and
timelines... Not to mention the fact that shape numbering is completely
disconnected between animation and macro objects (and finding the shape
numbers in either case is kludgy).

Presentation time is also not a robust environment; when I bring dialog
boxes up, sometimes they show up, sometimes not unless I restart PP. If you
show the File Browse dialog, it suddenly switches out of show mode to display
it, and when you close it you have to click back into show mode. Kinda breaks
the flow. I figure not many people try to do this since it seems so untested.

Thanks!
BnB
 
B

Brian Reilly, MS MVP

BnB
The MouseOver attached to a full frame no fill/no line shape would do
the trick, but it is only bullet proof if the slide show is set up in
Kiosk mode. But then you need forward and back buttons in that case.

Brian Reilly, MVP
 
B

BnB

Here's some sample code. The first is a routine that executes to bring up a
dialog (as a MouseClick ActionEvent). It was intended to be complete,
loading/showing, then unloading when done. What would happen is that the
first time it ran, the dialog would show; the next time it wouldn't. (This
was not ALWAYS the case, but more often than not.) You'll note below that I
commented the unload instruction; this seemed to fix the situation. Which
means that it realistically could only load once reliably, then it got
confused. So what's posted below works, but would be cleaner with the unload
intact.

BTW, OffloadForm.Valid is simply a property I give to the UserForm to
indicate that the form contents when closed should be acted on.

Skip beyond this to see the Browse dialog code.

Public Sub DoOffload()

Load OffloadForm
OffloadForm.Show
If OffloadForm.Valid Then
If OffloadForm.AsynchOption Then
Application.ActivePresentation.Slides(3).Shapes("Group
98").Visible = msoTrue
Application.ActivePresentation.Slides(3).Shapes("Group
115").Visible = msoTrue
Else
Application.ActivePresentation.Slides(3).Shapes("Group
103").Visible = msoTrue
Application.ActivePresentation.Slides(3).Shapes("Group
127").Visible = msoTrue
End If
End If

'Unload OffloadForm
ClearMenuHighlights
HideMenu

End Sub

The Browse dialog issue is such that when the dialog runs, it comes up, but
pops PPT out of show mode.

Private Sub BrowseButton_Click()
Dim lDialog As FileDialog

Set lDialog = Application.FileDialog(msoFileDialogFilePicker)
If lDialog.Show = -1 Then Me.RTLFileBox = lDialog.SelectedItems(1)

Set lDialog = Nothing

End Sub
 

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