To Property

Microsoft PowerPoint Visual Basic

Show All

To Property

       

To property as it applies to the ColorEffect object.

Sets or returns a ColorFormat object that represents the RGB color value of an animation behavior. Read/write.

expression.To

expression   Required. An expression that returns a ColorEffect object.

Remarks

Use this property in conjunction with the From property to transition from one color to another.

To property as it applies to the RotationEffect object.

Sets or returns a Single that represents the ending rotation of an object in degrees, specified relative to the screen (for example, 90 degrees is completely horizontal). Read/write.

expression.To

expression   Required. An expression that returns a RotationEffect object.

Remarks

Use this property in conjunction with the From property to transition from one rotation angle to another.

The default value is Empty in which case the current position of the object is used.

To property as it applies to the PropertyEffect object.

Sets or returns a Variant that represents the ending value of an object’s property. Read/write.

expression.To

expression   Required. An expression that returns a PropertyEffect object.

Remarks

The default value is Empty, in which case the current position of the object is used.

Remarks

Do not confuse this property with the ToX or ToY properties of the ScaleEffect and MotionEffect objects, which are only used for scaling or motion effects.

Example

As it applies to the ColorEffect object.

The following example adds a color effect and changes its color from a light bluish green to yellow.

Sub AddAndChangeColorEffect()
    Dim effBlinds As Effect
    Dim tmlTiming As TimeLine
    Dim shpRectangle As Shape
    Dim animColor As AnimationBehavior
    Dim clrEffect As ColorEffect

    Set shpRectangle = ActivePresentation.Slides(1).Shapes _
        .AddShape(Type:=msoShapeRectangle, Left:=100, _
        Top:=100, Width:=50, Height:=50)
    Set tmlTiming = ActivePresentation.Slides(1).TimeLine
    Set effBlinds = tmlTiming.MainSequence.AddEffect(Shape:=shpRectangle, _
        effectId:=msoAnimEffectBlinds)
    Set animColor = tmlTiming.MainSequence(1).Behaviors _
        .Add(Type:=msoAnimTypeColor)
    Set clrEffect = animColor.ColorEffect

    clrEffect.From.RGB = RGB(Red:=255, Green:=255, Blue:=0)
    clrEffect.To.RGB = RGB(Red:=0, Green:=255, Blue:=255)
End Sub

As it applies to the RotationEffect object.

The following example adds a rotation effect and immediately changes its rotation angle from 90 degrees to 270 degrees.

Sub AddAndChangeRotationEffect()
    Dim effBlinds As Effect
    Dim tmlTiming As TimeLine
    Dim shpRectangle As Shape
    Dim animColor As AnimationBehavior
    Dim rtnEffect As RotationEffect

    Set shpRectangle = ActivePresentation.Slides(1).Shapes(1)
    Set tmlTiming = ActivePresentation.Slides(1).TimeLine
    Set effBlinds = tmlTiming.MainSequence.AddEffect(Shape:=shpRectangle, _
        effectId:=msoAnimEffectBlinds)
    Set animColor = tmlTiming.MainSequence(1).Behaviors.Add(Type:=msoAnimTypeRotation)
    Set rtnEffect = animColor.RotationEffect

    rtnEffect.From = 90
    rtnEffect.To = 270
End Sub