PowerPoint (的 ShapeRange.HasTextFrame 屬性)

會傳回指定的圖案是否具有文字圖文框。 唯讀。

語法

expressionHasTextFrame

表達 代表 ShapeRange 物件的 變數。

傳回值

MsoTriState

註解

HasTextFrame 屬性的值可以是下列其中一個 MsoTriState 常數。

常數 描述
msoFalse 指定的圖案沒有文字圖文框,因此無法包含文字。
msoTrue 指定的圖案具有文字圖文框,因此可以包含文字。

範例

在這個範例中,會從第一張投影片上包含文字圖文框的所有圖案中擷取文字,然後會將這些圖案的名稱以及它們所包含的文字儲存成陣列。

Dim shpTextArray() As Variant
Dim numShapes, numAutoShapes, i As Long

Set myDocument = ActivePresentation.Slides(1)

With myDocument.Shapes
    numShapes = .Count
    If numShapes > 1 Then
        numTextShapes = 0
        ReDim shpTextArray(1 To 2, 1 To numShapes)
        For i = 1 To numShapes
            If .Item(i).HasTextFrame Then
                numTextShapes = numTextShapes + 1
                shpTextArray(numTextShapes, 1) = .Item(i).Name
                shpTextArray(numTextShapes, 2) = .Item(i) _
                    .TextFrame.TextRange.Text
            End If
        Next
        ReDim Preserve shpTextArray(1 To 2, 1 To numTextShapes)
    End If
End With

另請參閱

ShapeRange 物件

支援和意見反應

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