RotationEffect.By property (PowerPoint)

Sets or returns a Single that represents the rotation of an object by the specified number of degrees; for example, a value of 180 means to rotate the object by 180 degrees. Read/write.

Syntax

expression. By

expression A variable that represents a RotationEffect object.

Remarks

The specified object will be rotated with the center of the object remaining in the same position on the screen.

If both the By and To properties are set for a rotation effect, then the value of the By property is ignored.

Floating point numbers (for example, 55.5) are valid, but negative numbers are not.

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

Example

This example adds a rotation effect and changes its rotation.

Sub AddAndChangeRotationEffect()
    Dim effBlinds As Effect
    Dim tmlnShape As TimeLine
    Dim shpShape As Shape
    Dim animBehavior As AnimationBehavior
    Dim rtnEffect As RotationEffect

    'Sets shape, timing, and effect
    Set shpShape = ActivePresentation.Slides(1).Shapes(1)
    Set tmlnShape = ActivePresentation.Slides(1).TimeLine
    Set effBlinds = tmlnShape.MainSequence.AddEffect _
        (Shape:=shpShape, effectId:=msoAnimEffectBlinds)

    'Adds animation behavior and sets rotation effect
    Set animBehavior = tmlnShape.MainSequence(1).Behaviors _
        .Add(Type:=msoAnimTypeRotation)
    Set rtnEffect = animBehavior.RotationEffect

    rtnEffect.By = 270
End Sub

See also

RotationEffect Object

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.