PowerPoint) (ColorEffect.By 屬性

會傳回 ColorFormat 物件,代表所指定的數字,以 RGB 格式表示物件的色彩變更。 唯讀。

語法

expression。 By

運算式 代表 ColorEffect 物件的變數。

註解

請勿將此屬性與 ByX 或 ByY 屬性的 ScaleEffect 和 MotionEffect 物件,這用於調整效果或動作效果。

範例

此範例會新增色彩效果並變更其色彩。 此範例假設使用中簡報的第一張投影片上至少有一個圖形。

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

另請參閱

ColorEffect 物件

支援和意見反應

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