Shape.HasTextFrame property (Publisher)

Returns an MsoTriState constant if the specified shape has a TextFrame object associated with it. Read-only.

Syntax

expression.HasTextFrame

expression A variable that represents a Shape 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.

Constant Description
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.

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

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.