PDA

View Full Version : Automate the fly-inanimation to a text box



rdevdass
01-21-2013, 03:11 AM
I need to animate a text box , such that when I play a slide, the text book fly -in from left to right in the fast mode. I have many such animations in a presentation which I estimate cam grow up to 60 slides , I have no knowledge of VBA for power point, also the record button is not available in ppt to allow me recording this routine, can someone help me with a VBA code , also please tell me how to attach it on a menu
Thanks

John Wilson
01-21-2013, 05:14 AM
You need to start by saying which version you have. The macro recorder was fairly useless and has NEVER recorded a macro to add animation.

Generic code to add the animation to the selected shape.

Sub addFlyIn()
Dim osld As Slide
Dim oshp As Shape
Dim oeff As Effect
'make sure shape selected
If ActiveWindow.Selection.Type = ppSelectionNone Then Exit Sub
If ActiveWindow.Selection.ShapeRange.Count = 0 Then Exit Sub
'all ok
Set oshp = ActiveWindow.Selection.ShapeRange(1)
Set osld = ActiveWindow.Selection.SlideRange(1)
Set oeff = osld.TimeLine.MainSequence.AddEffect(Shape:=oshp, effectid:=msoAnimEffectFly, trigger:=msoAnimTriggerOnPageClick)
With oeff
oeff.Timing.Duration = 1
oeff.EffectParameters.Direction = msoAnimDirectionLeft
End With
End Sub