Partager via


CanvasShapes.AddTextbox Method (Word)

Adds a text box to a drawing canvas. Returns a Shape object that represents the text box.

Syntax

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

expression Required. A variable that represents a CanvasShapes collection.

Parameters

Name

Required/Optional

Data Type

Description

Orientation

Required

MsoTextOrientation

The orientation of the text. Some of the MsoTextOrientation constants may not be available to you, depending on the language support (U.S. English, for example) that you’ve 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.

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

Concepts

CanvasShapes Object Members

CanvasShapes Collection