This documentation is archived and is not being maintained.

ShapeRange.HasTextFrame Property

Office 2007
Indicates whether the specified shape has a TextFrame object associated with it. Read-only.

Syntax

expression.HasTextFrame

expression   A variable that represents a ShapeRange object.

Remarks

If the HasTextFrame property is true, clients must check the value of the HasText property of the TextFrame object to determine if there is any text on the shape.

The HasTextFrame property value can be one of the MsoTriState constants declared in the Microsoft Office type library and shown in the following table.

ConstantDescription
msoFalse The specified shape does not have a TextFrame object associated with it.
msoTriStateMixed Indicates a combination of msoTrue and msoFalse for the specified shape range.
msoTrue The specified shape has a TextFrame object associated with it.

Example
This example tests all the shapes in the selection and if none have text frames associated with them, they are left aligned.

Visual Basic for Applications
Sub MoveLeft()

    Dim shpAll As ShapeRange

    Set shpAll = Application.ActiveDocument.Selection.ShapeRange
    If shpAll.HasTextFrame = msoFalse Then
        shpAll.Align msoAlignLefts, msoTrue
    End If

End Sub



Show: