Effect object (PowerPoint)

Represents timing information about a slide animation.

Example

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) method, 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

Methods

Name
Delete
MoveAfter
MoveBefore
MoveTo

Properties

Name
Application
Behaviors
DisplayName
EffectInformation
EffectParameters
EffectType
Exit
Index
Paragraph
Parent
Shape
TextRangeLength
TextRangeStart
Timing

See also

PowerPoint Object Model Reference

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.