Shapes.AddTextbox method (Word)

Adds a text box to a drawing canvas.

Syntax

expression. AddTextbox( _Orientation_ , _Left_ , _Top_ , _Width_ , _Height_ )

expression Required. A variable that represents a Shapes object.

Parameters

Name Required/Optional Data type Description
Orientation Required MsoTextOrientation The orientation of the text. Some of these constants may not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
Left Required Single The position, measured in points, of the left edge of the text box.
Top Required Single The position, measured in points, of the top edge of the text box.
Width Required Single The width, measured in points, of the text box.
Height Required Single The height, measured in points, of the text box.

Return value

Shape

Example

This example add a textbox to a canvas in a new document.

Sub NewCanvasTextbox() 
 Dim docNew As Document 
 Dim shpCanvas As Shape 
 
 'Create a new document and add a drawing canvas 
 Set docNew = Documents.Add 
 Set shpCanvas = docNew.Shapes.AddCanvas _ 
 (Left:=100, Top:=75, Width:=150, Height:=200) 
 
 'Add a text box to the drawing canvas 
 shpCanvas.CanvasItems.AddTextbox _ 
 Orientation:=msoTextOrientationHorizontal, _ 
 Left:=1, Top:=1, Width:=100, Height:=100 
End Sub

See also

Shapes Collection 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.