Office) (TextRange2.Length 屬性

取得代表文字範圍長度的 Long 。 唯讀。

語法

運算式。長度

運算式 傳回 TextRange2 物件的運算式。

傳回值

Long

範例

這個範例會在使用中 PowerPoint 簡報內新增含有文字的圖案,而且會旋轉此圖案但不旋轉其中的文字。

Sub SetTextRange() 
 Dim shpStar As Shape 
 Dim sldOne As Slide 
 Dim effNew As Effect 
 
 Set sldOne = ActivePresentation.Slides(1) 
 Set shpStar = sldOne.Shapes.AddShape(Type:=msoShape5pointStar, _ 
 Left:=32, Top:=32, Width:=300, Height:=300) 
 
 shpStar.TextFrame.TextRange2.Text = "Animated shape." 
 
 Set effNew = sldOne.TimeLine.MainSequence.AddEffect(Shape:=shpStar, _ 
 EffectId:=msoAnimEffectPath5PointStar, Level:=msoAnimateTextByAllLevels, _ 
 Trigger:=msoAnimTriggerAfterPrevious) 
 With effNew 
 If .TextRangeStart = 0 And .TextRangeLength > 0 Then 
 With .Behaviors.Add(Type:=msoAnimTypeRotation).RotationEffect 
 .From = 0 
 .To = 360 
 End With 
 .Timing.AutoReverse = msoTrue 
 End If 
 End With 
End Sub 

另請參閱

支援和意見反應

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