Class TextFrame (Word VBA)

The class TextFrame represents the text frame in a Shape object. The TextFrame object contains the text in the text frame and the properties that control the margins and orientation of the text frame.


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

Dim tfe as TextFrame
Set tfe = ActiveDocument.Background.TextFrame

The following procedures can be used to set variables of type TextFrame: Shape.TextFrame, ShapeRange.TextFrame, Next and Previous


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

Format with its procedures MarginBottom, MarginLeft, MarginRight, MarginTop, PathFormat and WarpFormat


AutoSize returns or sets a Long that represents whether a text frame is sized automatically.

ActiveDocument.Background.TextFrame.AutoSize =

Column this object, member, or enumeration is deprecated and is not intended to be used in your code.

Dim tc2Column As Office.TextColumn2
Set tc2Column = ActiveDocument.Background.TextFrame.Column

ContainingRange returns a Range object that represents the entire story in a series of shapes with linked text frames that the specified text frame belongs to.

Dim rngContainingRange As Range
Set rngContainingRange = ActiveDocument.Background.TextFrame.ContainingRange

HasText true if the specified shape has text associated with it.

Dim lngHasText As Long
lngHasText = ActiveDocument.Background.TextFrame.HasText

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

ActiveDocument.Background.TextFrame.HorizontalAnchor =

Next returns a TextFrame object that represents the next text frame in a collection of shapes.

ActiveDocument.Background.TextFrame.Next =

NoTextRotation true if text in the text frame should not rotate when the shape is rotated.

ActiveDocument.Background.TextFrame.NoTextRotation =

Orientation returns or sets the orientation of the text inside the frame.

ActiveDocument.Background.TextFrame.Orientation =

Overflowing true if the text inside the specified text frame doesn't all fit within the frame.

Dim booOverflowing As Boolean
booOverflowing = ActiveDocument.Background.TextFrame.Overflowing

Parent returns a Shape object that represents the parent shape of the text frame.

Dim shpParent As Shape
Set shpParent = ActiveDocument.Background.TextFrame.Parent

Previous returns a TextFrame object that represents the previous text frame in a collection of shapes.

ActiveDocument.Background.TextFrame.Previous =

TextRange returns a Range object that represents the text in the specified text frame.

Dim rngTextRange As Range
Set rngTextRange = ActiveDocument.Background.TextFrame.TextRange

ThreeD returns a ThreeDFormat object that contains 3D effect formatting properties for the specified text frame.

Dim tdfThreeD As ThreeDFormat
Set tdfThreeD = ActiveDocument.Background.TextFrame.ThreeD

VerticalAnchor returns or sets an MsoVerticalAnchor constant that represents the vertical alignment of the text within a shape.

ActiveDocument.Background.TextFrame.VerticalAnchor =

WordWrap true if Microsoft Word wraps Latin text in the middle of a word in the specified text frames. Read/write Long.

ActiveDocument.Background.TextFrame.WordWrap =