Class TextFrame2 (PowerPoint VBA)

The class TextFrame2 represents the text frame in a Shape or ShapeRange object. Contains the text in the text frame and exposes properties and methods that control the alignment and anchoring of the text frame.

Set

To use a TextFrame2 class variable it first needs to be instantiated, for example

Dim tf2 as TextFrame2
Set tf2 = ActiveWindow.RangeFromPoint.TextFrame2

The following procedures can be used to set variables of type TextFrame2: ChartFormat.TextFrame2, Shape.TextFrame2 and ShapeRange.TextFrame2

Themes

The following procedures in this class have been grouped together and are described on a separate theme page

Format with its procedures PathFormat, WarpFormat and WordArtFormat

Properties

AutoSize returns or sets a value that indicates whether the size of the specified shape is changed automatically to fit text within its boundaries.

ActivePresentation.Slides(1).Shapes(1).TextFrame2.AutoSize = msoAutoSizeMixed

Column returns the Column object that represents the columns of the specified text frame.

Dim tc2Column As Office.TextColumn2
Set tc2Column = ActivePresentation.Slides(1).Shapes(1).TextFrame2.Column

HasText indicates whether the shape that contains the specified text frame has text associated with it.

Dim mtsHasText As Office.MsoTriState
mtsHasText = ActivePresentation.Slides(1).Shapes(1).TextFrame2.HasText

HorizontalAnchor returns or sets the horizontal alignment of text in a text frame.

ActivePresentation.Slides(1).Shapes(1).TextFrame2.HorizontalAnchor = msoHorizontalAnchorMixed

MarginBottom returns or sets the distance (in points) between the bottom of the text frame and the bottom of the inscribed rectangle of the shape that contains the text.

ActivePresentation.Slides(1).Shapes(1).TextFrame2.MarginBottom = 6

MarginLeft returns or sets the distance (in points) between the left edge of the text frame and the left edge of the inscribed rectangle of the shape that contains the text.

ActivePresentation.Slides(1).Shapes(1).TextFrame2.MarginLeft = 6

MarginRight returns or sets the distance (in points) between the right edge of the text frame and the right edge of the inscribed rectangle of the shape that contains the text.

ActivePresentation.Slides(1).Shapes(1).TextFrame2.MarginRight = 6

MarginTop returns or sets the distance (in points) between the top of the text frame and the top of the inscribed rectangle of the shape that contains the text.

ActivePresentation.Slides(1).Shapes(1).TextFrame2.MarginTop = 6

NoTextRotation indicates whether to rotate text with the TextFrame2 rotation. One of the MsoTriState constants.

ActiveWindow.RangeFromPoint.TextFrame2.NoTextRotation = msoTrue

Orientation returns or sets text orientation.

ActivePresentation.Slides(1).Shapes(1).TextFrame2.Orientation = msoTextOrientationMixed

Parent returns the parent object of the specified test frame. Read-only.

Dim objParent As Object
Set objParent = ActiveWindow.RangeFromPoint.TextFrame2.Parent

Ruler returns a Ruler2 object that represents the ruler for the specified text.

Dim rlrRuler As Office.Ruler2
Set rlrRuler = ActivePresentation.Slides(1).Shapes(1).TextFrame2.Ruler

TextRange returns a TextRange2 object (PowerPoint) object that represents the text in the specified text frame.

Dim tr2TextRange As Office.TextRange2
Set tr2TextRange = ActivePresentation.Slides(1).Shapes(1).TextFrame2.TextRange

ThreeD returns a ThreeDFormat object that represents the three-dimensional formatting of the parent shape.

Dim tdfThreeD As ThreeDFormat
Set tdfThreeD = ActiveWindow.RangeFromPoint.TextFrame2.ThreeD

VerticalAnchor returns or sets the vertical alignment of text in a text frame.

ActivePresentation.Slides(1).Shapes(1).TextFrame2.VerticalAnchor = msoVerticalAnchorMixed

WordWrap determines whether lines of text break automatically to fit inside the shape.

ActiveWindow.RangeFromPoint.TextFrame2.WordWrap = msoTrue