Table of contents
Collapse the table of content
Expand the table of content

ColorEffect Object (PowerPoint)

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

Represents a color effect for an animation behavior.


Use the ColorEffectproperty of the AnimationBehavior object to return a ColorEffect object. Color effects can be changed using the ColorEffect object'sFromand Toproperties, as shown below. Color effects are initially set using the To property, and then can be changed by a specific number using theByproperty. The following example adds a shape to the first slide of the active presentation and sets a color effect animation behavior to change the fill color of the new shape.

Sub ChangeColorEffect()

    Dim sldFirst As Slide
    Dim shpHeart As Shape
    Dim effNew As Effect
    Dim bhvEffect As AnimationBehavior

    Set sldFirst = ActivePresentation.Slides(1)

    Set shpHeart = sldFirst.Shapes.AddShape(Type:=msoShapeHeart, _
        Left:=100, Top:=100, Width:=100, Height:=100)

    Set effNew = sldFirst.TimeLine.MainSequence.AddEffect _
        (Shape:=shpHeart, EffectID:=msoAnimEffectChangeFillColor, _

    Set bhvEffect = effNew.Behaviors.Add(Type:=msoAnimTypeColor)

    With bhvEffect.ColorEffect
        .From.RGB = RGB(Red:=255, Green:=0, Blue:=0)
        .To.RGB = RGB(Red:=0, Green:=0, Blue:=255)
    End With

End Sub

See also


PowerPoint Object Model Reference

© 2018 Microsoft