PowerPoint) (MotionEffect.ToX 屬性

設定或傳回 單一 表示以的螢幕寬度百分比指定 MotionEffect 物件的水平位置。 讀取/寫入。

語法

expressionToX

表達 代表 MotionEffect 物件的 變數。

傳回值

單一

註解

此屬性的預設值為 空白 ,用於哪種案例物件的目前位置。

使用此屬性與 FromX 屬性配合調整大小或從某個位置跳至另一個。

請勿將這個屬性與 ColorEffectRotationEffectPropertyEffect 物件屬性是用來分別設定或變更色彩、 旋轉或其他動畫行為的屬性。

範例

下列範例會新增動畫路徑並設定開始和結束的水平和垂直位置。

Sub AddMotionPath()

    Dim effCustom As Effect
    Dim animMotion As AnimationBehavior
    Dim shpRectangle As Shape

    'Adds shape and sets effect and animation properties
    Set shpRectangle = ActivePresentation.Slides(1).Shapes _
        .AddShape(Type:=msoShapeRectangle, Left:=100, _

        Top:=100, Width:=50, Height:=50)

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

    Set animMotion = effCustom.Behaviors.Add(msoAnimTypeMotion)

    'Sets starting and ending horizontal and vertical positions
    With animMotion.MotionEffect
        .FromX = 0
        .FromY = 0
        .ToX = 50
        .ToY = 50
    End With

End Sub

另請參閱

MotionEffect 物件

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應