RepeatDuration Property

Microsoft PowerPoint Visual Basic

expression.RepeatDuration

expression    Required. An expression that returns one of the objects in the Applies To list.

Remarks

An animation will stop at the end of its time sequence or the value of the RepeatDuration property, whichever is shorter.

Example

This examples adds a shape and an animation to it, then repeats the animation ten times. However, after five seconds, the animation will be cut off, even though the animation is dimensioned for a 20-second timeline (if the Duration property is not specified, an animation defaults to two seconds).

Sub AddShapeSetTiming()
    Dim effDiamond As Effect
    Dim shpRectangle As Shape

    'Adds new shape and sets animation effect
    Set shpRectangle = ActivePresentation.Slides(1).Shapes _
        .AddShape(Type:=msoShapeRectangle, Left:=100, _
        Top:=100, Width:=50, Height:=50)
    Set effDiamond = ActivePresentation.Slides(1).TimeLine.MainSequence _
        .AddEffect(Shape:=shpRectangle, effectId:=msoAnimEffectPathDiamond)

    'Sets repeat duration and number of times to repeat animation
    With effDiamond.Timing
        .RepeatDuration = 5
        .RepeatCount = 10
    End With

End Sub