AddTextbox Method

Applies To

Shapes collection object.

Description

Creates a text box. Returns a Shape object that represents the new text box.

Syntax

expression.AddTextbox(Orientation, Left, Top, Width, Height, Anchor)

expression Required. An expression that returns a Shapes collection.

Orientation Required Long. The orientation of the text. Can be one of the following MsoTextOrientation constants: msoTextOrientationDownward, msoTextOrientationHorizontal, msoTextOrientationMixed, or msoTextOrientationUpward. (Don't use any MsoTextOrientation constants other than these in U.S. English versions of Word.)

Left, Top Required Single. The position (in points) of the upper-left corner of the text box, relative to the anchor.

Width, Height Required Single. The width and height of the text box, in points.

Anchor Optional Variant. A Range object that represents the text that the text box is bound to. If Anchor is specified, the anchor is positioned at the beginning of the first paragraph in the anchoring range. If this argument is omitted, the anchoring range is selected automatically and the text box is positioned relative to the top and left edges of the page.

See Also

CreateTextbox method, TextFrame object.

Example

This example adds a text box that contains the text "Test Box" to a new document.

Set myDocument = Documents.Add
Set myTBox = myDocument.Shapes.AddTextBox(Orientation:=msoTextOrientationHorizontal, _
    Left:=100, Top:=100, Width:=300, Height:=200)
myTBox.TextFrame.TextRange = "Test Box"