Effect Object

Effect Object
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Sequence
Aa201149.parchild(en-us,office.10).gifEffect
Aa201149.space(en-us,office.10).gifAa201149.parchild(en-us,office.10).gif

Represents timing information about a slide animation.

Using the Effect object

Use the AddEffect method to add an effect. This example adds a shape to the first slide in the active presentation and adds an effect and a behavior to the shape.

  Sub NewShapeAndEffect()
    Dim shpStar As Shape
    Dim sldOne As Slide
    Dim effNew As Effect

    Set sldOne = ActivePresentation.Slides(1)
    Set shpStar = sldOne.Shapes.AddShape(Type:=msoShape5pointStar, _
        Left:=150, Top:=72, Width:=400, Height:=400)
    Set effNew = sldOne.TimeLine.MainSequence.AddEffect(Shape:=shpStar, _
        EffectId:=msoAnimEffectStretchy, Trigger:=msoAnimTriggerAfterPrevious)
    With effNew
        With .Behaviors.Add(msoAnimTypeScale).ScaleEffect
            .FromX = 75
            .FromY = 75
            .ToX = 0
            .ToY = 0
        End With
        .Timing.AutoReverse = msoTrue
    End With
End Sub

To refer to an existing Effect object, use  MainSequence(index), where index is the number of the Effect object in the Sequence collection. This example changes the effect for the first sequence and specifies the behavior for that effect.

  Sub ChangeEffect()
    With ActivePresentation.Slides(1).TimeLine _
        .MainSequence(1)
        .EffectType = msoAnimEffectSpin
        With .Behaviors(1).RotationEffect
            .From = 100
            .To = 360
            .By = 5
        End With
    End With
End Sub

There is always at least one Effect object in each slide regardless of whether the slide has animations or not.