By Property

Microsoft PowerPoint Visual Basic

Returns a ColorFormat object that represents a change to the color of the object by the specified number, expressed in RGB format.

expression.By

expression    Required. An expression that returns a ColorEffect object.

ShowBy property as it applies to the RotationEffect object.

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.

expression.By

expression    Required. An expression that returns 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.

Remarks

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

ShowAs it applies to the ColorEffect object.

This example adds a color effect and changes its color. This example assumes there is at least one shape on the first slide of the active presentation.

Sub AddAndChangeColorEffect()
    Dim effBlinds As Effect
    Dim tmlnShape As TimeLine
    Dim shpShape As Shape
    Dim animBehavior As AnimationBehavior
    Dim clrEffect As ColorEffect

    '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 color effect
    Set animBehavior = tmlnShape.MainSequence(1).Behaviors _
        .Add(Type:=msoAnimTypeColor)
    Set clrEffect = animBehavior.ColorEffect

    'Specifies color
    clrEffect.By.RGB = RGB(Red:=255, Green:=0, Blue:=0)
End Sub
				

ShowAs it applies to the RotationEffect object.

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