Effect Object (PowerPoint)
Represents timing information about a slide animation.
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.