共用方式為


ColorEffect.來自 PowerPoint (property)

設定或傳回 ColorFormat 物件,代表動畫行為的起始 RGB 色彩值。

語法

expressionFrom

一個代表 ColorEffect 物件的變數。

註解

將這個屬性搭配 To 屬性使用,即可從某個色彩轉換成另一個色彩。

請勿將此屬性與 FromXFromY 屬性的 ScaleEffectMotionEffect 物件,這用於調整效果或動作效果。

範例

下列範例會加入新的色彩效果,並立即變更其顏色。

Sub AddAndChangeColorEffect() 
    Dim effBlinds As Effect 
    Dim tlnTiming As TimeLine 
    Dim shpRectangle As Shape 
    Dim animColorEffect As AnimationBehavior 
    Dim clrEffect As ColorEffect 
 
    'Adds rectangle and sets effect and animation 
    Set shpRectangle = ActivePresentation.Slides(1).Shapes _ 
        .AddShape(Type:=msoShapeRectangle, Left:=100, _ 
        Top:=100, Width:=50, Height:=50) 
    Set effBlinds = t.MainSequence.AddEffect(Shape:=shpRectangle, _ 
        effectId:=msoAnimEffectBlinds) 
    Set animColorEffect = tlnTimming.MainSequence(1).Behaviors _ 
        .Add(Type:=msoAnimTypeColor) 
    Set clrEffect = animColorEffect.ColorEffect 
 
    'Sets the animation effect starting and ending colors 
    clrEffect.From.RGB = RGB(Red:=255, Green:=255, Blue:=0) 
    clrEffect.To.RGB = RGB(Red:=0, Green:=255, Blue:=255) 
End Sub

另請參閱

ColorEffect 物件

支援和意見反應

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