Skip to content

Latest commit

 

History

History
80 lines (50 loc) · 1.81 KB

PowerPoint.Shape.HasTextFrame.md

File metadata and controls

80 lines (50 loc) · 1.81 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
Shape.HasTextFrame property (PowerPoint)
vbapp10.chm547055
vbapp10.chm547055
PowerPoint.Shape.HasTextFrame
ea1a53e4-32d8-e51f-9e60-9ef719c0d973
06/08/2017
medium

Shape.HasTextFrame property (PowerPoint)

Returns whether the specified shape has a text frame. Read-only.

Syntax

expression. HasTextFrame

expression A variable that represents a Shape object.

Return value

MsoTriState

Remarks

The value of the HasTextFrame property can be one of these MsoTriState constants.

Constant Description
msoFalse The specified shape does not have a text frame and therefore cannot contain text.
msoTrue The specified shape has a text frame and can therefore contain text.

Example

This example extracts text from all shapes on the first slide that contain text frames, and then it stores the names of these shapes and the text they contain in an array.

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

See also

Shape Object

[!includeSupport and feedback]