OfficeTips Home || VBA Section || General Section || Download Section || Privacy Policy

How to jump to a particular animation during slideshow

Microsoft introduced some new methods/properties in PowerPoint 2007 associated with the SlideShowWindow object. These are GotoClick, GetClickIndex, GetClickCount and FirstAnimationIsAutomatic.

 

One of the often requested features is the ability to track the state of the presentation. How many animations were fired in the slide, how many more to go, most importantly jump to a specific animation in the slide during slideshow. Previously to achieve this meant needing an event handler to track and jump to the correct point. Additions in PPT 2007 for the SlideShowWindow object make all this so easy.

GetClickCount: This property returns the number of click animations on the slide.

 

GetClickIndex: This property returns the last fired animation or the animation that is currently playing. If a slide has no animations or if a user has not advanced yet to an animation, the GetClickIndex method returns 0. If a slide has an animation that runs automatically and the user moves to the previous page, the GetClickIndex method returns msoClickStateBeforeAutomaticAnimations.

 

GotoClick(Index as long): This is the method that you should use to jump to a specific animation point in the slide during a slideshow. It accepts a value as an argument when index of the animation to which you wish to jump. Specifying 0 for Index plays animations beginning at the point just before any animations that run automatically. Specifying msoClickStateBeforeAutomaticAnimations jumps to the point just before any animations that run automatically, and then pauses. Specifying msoClickStateAfterAllAnimations jumps to the point after all animations. All intermediate animation animation between the current animation and the final jump position appear in this final animated state had they been fired in sequence.
 

FirstAnimationIsAutomatic: Returns True if the first animation on the slide is set to advance automatically.

 

Let us look at an example. To set this up

1. Create a slide with at least 3 or more click animations on it.

2. Copy/paste this macro into a code module of the presentation.

3. Assign an action setting to a shape on the slide to run this macro.

4. Start the slideshow and then click on the shape with the action setting to fire this macro.

 

 

Sub JumpToAnimation()
	Dim lngCount As Long
	Dim lngCurrentIndex As Long
	
	'Get the total number of click animations on the slide.
	lngCount = SlideShowWindows(1).View.GetClickCount
	MsgBox "There are " & CStr(lngCount) & " click animations on the slide.", vbInformation
	
	'Get the current index of click animations on the slide.
	lngCurrentIndex = SlideShowWindows(1).View.GetClickIndex
	MsgBox "The current click position is " & CStr(lngCurrentIndex) & " on the slide.", vbInformation
	
	'Jump to the 3rd mouse click.
	Call SlideShowWindows(1).View.GotoClick(3)
End Sub
 
 
   


Copyright 1999-2018 (c) Shyam Pillai. All rights reserved.