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

ScaleEffect.ByX Property (PowerPoint)

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

Sets or returns a Single that represents scaling or moving an object horizontally by a specified percentage of the screen width, depending on whether it used in conjunction with a ScaleEffect or MotionEffect object, respectively. For example, a value of 50 for a motion effect means to move the object half the screen width to the right. Read/write.

Syntax

expression. ByX

expression A variable that represents a ScaleEffect object.

Return Value

Single

Remarks

Negative numbers move the object horizontally to the left. Floating point numbers (for example, 55.5) are allowed.

To scale or move an object vertically, use the ByY property.

If both the ByX and ByY properties are set, then the object is scaled or moves both horizontally and vertically.

Do not confuse this property with the By property of the ColorEffect, RotationEffect, or PropertyEffect objects, which is used to set colors, rotations, or other properties of an animation behavior, respectively.

Example

The following example adds an animation path; then sets the horizontal and vertical movement of the shape.

Sub AddMotionPath()

    Dim effCustom As Effect
    Dim animBehavior As AnimationBehavior
    Dim shpRectangle As Shape

    'Adds rectangle and sets effect and animation
    Set shpRectangle = ActivePresentation.Slides(1).Shapes _
        .AddShape(Type:=msoShapeRectangle, Left:=300, _
        Top:=300, Width:=300, Height:=150)

    Set effCustom = ActivePresentation.Slides(1).TimeLine _
        .MainSequence.AddEffect(Shape:=shpRectangle, _
         effectId:=msoAnimEffectCustom)

    Set animBehavior = effCustom.Behaviors.Add(msoAnimTypeMotion)

    'Specifies animation motion
    With animBehavior.MotionEffect
        .ByX = 50
        .ByY = 50
    End With

End Sub

See also

Concepts

ScaleEffect Object

© 2018 Microsoft