Consulting

Results 1 to 13 of 13

Thread: Solved: Next slide after animation

  1. #1
    VBAX Regular
    Joined
    Feb 2005
    Posts
    82
    Location

    Solved: Next slide after animation

    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

  2. #2
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    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.
    K :-)

  3. #3
    VBAX Regular
    Joined
    Feb 2005
    Posts
    82
    Location
    Quote Originally Posted by Killian
    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.

  4. #4
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    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...
    K :-)

  5. #5
    VBAX Regular
    Joined
    Feb 2005
    Posts
    82
    Location
    Quote Originally Posted by Killian
    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?

  6. #6
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    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[VBA]'##################
    ' 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 Sub[/VBA][VBA]Public myApp As Class1

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

    End Sub[/VBA]
    K :-)

  7. #7
    VBAX Regular
    Joined
    Feb 2005
    Posts
    82
    Location
    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

  8. #8
    VBAX Regular
    Joined
    Feb 2005
    Posts
    82
    Location
    It works again. Still trying to figure out how to get it to fire only on a specific slide.

  9. #9
    VBAX Regular
    Joined
    Feb 2005
    Posts
    82
    Location
    Here's what I did:

    [vba]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[/vba] Thanks again.
    Last edited by wnazzaro; 07-20-2006 at 01:27 PM.

  10. #10
    VBAX Regular
    Joined
    Feb 2005
    Posts
    82
    Location
    When I open the file, I actively have to run main() for this to work. Is there a way around this?

  11. #11
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    Hi Bill,

    We already have the current slide index (Wn.View.CurrentShowPosition) so that can be checked[VBA]Private 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[/VBA]
    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.
    K :-)

  12. #12
    VBAX Regular
    Joined
    Feb 2005
    Posts
    82
    Location
    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

  13. #13
    VBAX Master Killian's Avatar
    Joined
    Nov 2004
    Location
    London
    Posts
    1,132
    Location
    It's simple and only needs a bit of training for the people who will present.
    Sound like a very good idea...
    K :-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •