TextFrame.HorizontalAnchor property (Word)

Returns or sets the horizontal alignment of text in a text frame. Read/write MsoHorizontalAnchor.

Syntax

expression.HorizontalAnchor

expression A variable that represents a TextFrame object.

Example

The following code example shows how to set the alignment for the first shape in the active document to top center.

Public Sub HorizontalAnchor_Example() 
 
 With ActiveDocument.Shapes(1) 
 .TextFrame.HorizontalAnchor = msoAnchorCenter 
 .TextFrame.VerticalAnchor = msoAnchorTop 
 End With 
 
End Sub

See also

TextFrame 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.