Table of contents
TOC
Collapse the table of content
Expand the table of content

TextFrame Object (PowerPoint)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Represents the text frame in a Shape object. Contains the text in the text frame and the properties and methods that control the alignment and anchoring of the text frame.

Example

Use the TextFrame property to return a TextFrame object. The following example adds a rectangle to myDocument, adds text to the rectangle, and then sets the margins for the text frame.

Set myDocument = ActivePresentation.Slides(1)

With myDocument.Shapes _

        .AddShape(msoShapeRectangle, 0, 0, 250, 140).TextFrame

    .TextRange.Text = "Here is some test text"

    .MarginBottom = 10

    .MarginLeft = 10

    .MarginRight = 10

    .MarginTop = 10

End With

Use the HasTextFrameproperty to determine whether a shape has a text frame, and use the HasTextproperty to determine whether the text frame contains text, as shown in the following example.

Set myDocument = ActivePresentation.Slides(1)

For Each s In myDocument.Shapes

    If s.HasTextFrame Then

        With s.TextFrame

            If .HasText Then MsgBox .TextRange.Text

        End With

    End If

Next

Methods

Name
DeleteText

Properties

Name
Application
AutoSize
Creator
HasText
HorizontalAnchor
MarginBottom
MarginLeft
MarginRight
MarginTop
Orientation
Parent
Ruler
TextRange
VerticalAnchor
WordWrap

See also

Other resources

PowerPoint Object Model Reference

© 2017 Microsoft