PDA

View Full Version : Powerpoint Macros for flying in at 0.25 speed



JHaynes1
07-02-2019, 03:59 AM
Hi, what would the code be for a macro to change the animation of a selected item to flying in and change the speed to 1 second.

Thanks!

John Wilson
07-02-2019, 05:50 AM
This assumes that the selected shape is already animated and it's the first animation you want to change:


Sub change_to_fly()
Dim oshp As Shape
Dim osld As Slide
Dim oeff As Effect
On Error Resume Next
Set oshp = ActiveWindow.Selection.ShapeRange(1)
If Not oshp Is Nothing Then
Set osld = oshp.Parent
Set oeff = osld.TimeLine.MainSequence.FindFirstAnimationFor(oshp)
With oeff
.EffectType = msoAnimEffectFly
.EffectParameters.Direction = msoAnimDirectionLeft
.Timing.Duration = 0.25
End With
End If
End Sub

To ADD the effect to an unanimated shape change the 'set oeff' line to

Set oeff = osld.TimeLine.MainSequence.AddEffect(oshp, msoAnimEffectFly, , msoAnimTriggerOnPageClick)