PDA

View Full Version : Solved: Next slide after animation



wnazzaro
07-12-2006, 02:26 PM
How do you program a slide transition to run after an animation? I know we could just click again, but was wondering how you could get the presentation to advance without clicking for the next slide. You would only click once, to begin the animation. After it was finished, the next slide would run. I can get the next slide to appear on mouse over, but don't know enough about the objects in PPT to figure out how to start an animation and then move to the next slide after it runs.

All help is greatly appreciated.

Kind regards,
Bill

Killian
07-14-2006, 02:57 AM
Are you looking to do this with VBA? It may be do-able with application events enabled.
AFAIK, there's no direct way to do this via the Slide Transition options but you can tell how long your animations last on each slide and just advance the slide after a fixed period of time.

wnazzaro
07-14-2006, 05:09 AM
Are you looking to do this with VBA? It may be do-able with application events enabled.
AFAIK, there's no direct way to do this via the Slide Transition options but you can tell how long your animations last on each slide and just advance the slide after a fixed period of time.

Yes, I'm trying to do it with VBA. The problem with timing the slide is that different people will be speaking throughout the slide and there is no way to time it.

Killian
07-14-2006, 08:34 AM
Hmmm....
well I can't find an event that will deal with this.
By enabling app events, the closest seems to be the "SlideShowNextBuild" event, which fires before each individual animation. unfortunately, I can't find a way to determine that it was the last shape that animated and it's time to move to the next slide...

I'll have another dig around but it's not looking promising...

wnazzaro
07-15-2006, 04:38 AM
Hmmm....
well I can't find an event that will deal with this.
By enabling app events, the closest seems to be the "SlideShowNextBuild" event, which fires before each individual animation. unfortunately, I can't find a way to determine that it was the last shape that animated and it's time to move to the next slide...

I'll have another dig around but it's not looking promising...
If it fires before the animation, could it be associated with the specific shape, and when the animation is fired for that (on a click) it waits 3 secs and then advances the slide?

Is that an element event or a slide event?

Killian
07-20-2006, 04:04 AM
OK, I think I've got something...

It's an application event that fires on each effect, so I figure that if you keep a counter going and increment it each time it fires, when the counter equals the number of effects on that slide, you can run the code to delay and then advance the slide'##################
' The class (called Class1)

Dim WithEvents app As Application
Dim i As Long

Private Sub Class_Initialize()
Set app = Application
i = 0
End Sub

Private Sub app_SlideShowNextBuild(ByVal Wn As SlideShowWindow)
Dim t As Date

t = Now()
i = i + 1
If i = Wn.Presentation.Slides(Wn.View.CurrentShowPosition).TimeLine.MainSequence.C ount Then
Do
'nothing
Loop Until Now() > DateAdd("s", 3, t)
Wn.View.Next
i = 0
End If

End SubPublic myApp As Class1

Sub main()
' create the appEvents class
Set myApp = New Class1

End Sub

wnazzaro
07-20-2006, 11:44 AM
I think this works. I'm not really sure how (I don't know class modules well) but I just pasted the code and it fires. I set the time to 0 because it doesn't advance until the animation has finished. Then I commented out the loop, since it doesn't seem necessary.

I just need to set it to the correct slide.

And while trying to figure out how to get it to fire only on slide 2, I did something and now it doesn't work. I'll try to figure out what happened, but how would you set it to fire only on slide 2?

Thanks,
Bill

wnazzaro
07-20-2006, 11:51 AM
It works again. Still trying to figure out how to get it to fire only on a specific slide.

wnazzaro
07-20-2006, 12:38 PM
Here's what I did:

Private Sub app_SlideShowNextBuild(ByVal Wn As SlideShowWindow)
If Application.ActivePresentation.SlideShowWindow.View.Slide.SlideID = 258 Then
i = i + 1
If i = Wn.Presentation.Slides(Wn.View.CurrentShowPosition).TimeLine.MainSequence.C ount Then
Wn.View.Next
i = 0
End If
End If
End Sub Thanks again.

wnazzaro
07-20-2006, 01:01 PM
When I open the file, I actively have to run main() for this to work. Is there a way around this?

Killian
07-21-2006, 03:22 AM
Hi Bill,

We already have the current slide index (Wn.View.CurrentShowPosition) so that can be checkedPrivate Sub app_SlideShowNextBuild(ByVal Wn As SlideShowWindow)
Dim s As Long

'get the current slide index
s = Wn.View.CurrentShowPosition
If s = 2 Then 'check for slide 2
i = i + 1
If i = Wn.Presentation.Slides(s).TimeLine.MainSequence.Count Then
Wn.View.Next
i = 0
End If
End If

End Sub

When I open the file, I actively have to run main() for this to work. Is there a way around this?
Unfortunately, PowerPoint presentations don't have events enabled so there is no way to trigger the code (like in Workbook/Document_Open in Excel/Word).
However, Add-Ins do have two special routine names that fire when they load/unload:
"Auto_Open" and "Auto_Close".
So one way to implement this would be to rename Sub "main" to "Auto_Open" and save the file as an Add-In (.ppa). When you load the Add-In, the code will fire, create the event class and this action will then apply to all presentations (which I guess would be no good).

What you may have to do then, is add a menu item in "Auto_Open", that when clicked either runs code to enable events (create that class) or, if they are already enabled, disable them (destroy the class: Set myApp = Nothing).
Use "Auto_Close" to remove the menu item.

wnazzaro
07-21-2006, 04:02 AM
My current solution is adding a slide at the beginning with a shape that says "click me." The click runs main() so that when you get to the correct slide the procedure fires. It's simple and only needs a bit of training for the people who will present.

Thanks again,
Bill

Killian
07-21-2006, 04:18 AM
It's simple and only needs a bit of training for the people who will present.
Sound like a very good idea...
:thumb