Shape.TextFrame property (PowerPoint)

Returns a TextFrame object that contains the alignment and anchoring properties for the specified shape or master text style.

Syntax

expression.TextFrame

expression A variable that represents a Shape object.

Return value

TextFrame

Remarks

Use the TextRange property of the TextFrame object to return the text in the text frame.

Use the HasTextFrame property to determine whether a shape contains a text frame before you apply the TextFrame property.

Example

This example adds a rectangle to myDocument, adds text to the rectangle, and sets the top margin for the text frame.

Set myDocument = ActivePresentation.Slides(1)

With myDocument.Shapes _
        .AddShape(msoShapeRectangle, 180, 175, 350, 140).TextFrame
    .TextRange.Text = "Here is some test text"
    .MarginTop = 10
End With

See also

Shape Object

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.