PowerPoint) (TextFrame 物件
代表文字圖文框中的 Shape 物件。 包含文字圖文框和屬性和方法,以控制的對齊方式或錨定之文字圖文框中的文字。
範例
您可以使用 TextFrame 屬性可傳回 TextFrame 物件。 下列範例會將矩形新增至 myDocument、 將文字新增至矩形,然後設定文字圖文框的邊界。
Set myDocument = ActivePresentation.Slides(1)
With myDocument.Shapes _
.AddShape(msoShapeRectangle, 0, 0, 250, 140).TextFrame
.TextRange.Text = "Here is some test text"
.MarginBottom = 10
.MarginLeft = 10
.MarginRight = 10
.MarginTop = 10
End With
使用HasTextFrame若要判斷圖案是否有文字圖文框,並使用HasText屬性 若要判斷文字圖文框是否包含文字,如下列範例所示的屬性。
Set myDocument = ActivePresentation.Slides(1)
For Each s In myDocument.Shapes
If s.HasTextFrame Then
With s.TextFrame
If .HasText Then MsgBox .TextRange.Text
End With
End If
Next
方法
名稱 |
---|
DeleteText |
屬性
名稱 |
---|
Application |
AutoSize |
Creator |
HasText |
HorizontalAnchor |
MarginBottom |
MarginLeft |
MarginRight |
MarginTop |
Orientation |
Parent |
Ruler |
TextRange |
VerticalAnchor |
WordWrap |
另請參閱
支援和意見反應
有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應。