Format related procedures in class TextFrame (Word VBA)

This page presents procedures from class TextFrame related to the theme Format: MarginBottom, MarginLeft, MarginRight, MarginTop, PathFormat and WarpFormat

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.

Set myDocument = ActiveDocument 
With myDocument.Shapes.AddShape(msoShapeRectangle, _ 
 0, 0, 250, 140).TextFrame 
 .TextRange.Text = "Here is some test text" 
 .MarginBottom = 0 
 .MarginLeft = 100 
 .MarginRight = 0 
 .MarginTop = 20 
End With

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.

Set myDocument = ActiveDocument 
With myDocument.Shapes.AddShape(msoShapeRectangle, _ 
 0, 0, 250, 140).TextFrame 
 .TextRange.Text = "Here is some test text" 
 .MarginBottom = 0 
 .MarginLeft = 100 
 .MarginRight = 0 
 .MarginTop = 20 
End With

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.

Set myDocument = ActiveDocument 
With myDocument.Shapes.AddShape(msoShapeRectangle, _ 
 0, 0, 250, 140).TextFrame 
 .TextRange.Text = "Here is some test text" 
 .MarginBottom = 0 
 .MarginLeft = 100 
 .MarginRight = 0 
 .MarginTop = 20 
End With

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.

Set myDocument = ActiveDocument 
With myDocument.Shapes.AddShape(msoShapeRectangle, _ 
 0, 0, 250, 140).TextFrame 
 .TextRange.Text = "Here is some test text" 
 .MarginBottom = 0 
 .MarginLeft = 100 
 .MarginRight = 0 
 .MarginTop = 20 
End With

PathFormat

Returns or sets the path type for the specified text frame.

The value of the PathFormat property can be one of the following MsoPathType constants:

ActiveDocument.Background.TextFrame.PathFormat =

WarpFormat

Returns or sets the warp format (how the text is warped) for the specified text frame.

ActiveDocument.Shapes(1).TextFrame.WarpFormat = msoWarpFormat15