AddTextbox Method
AddTextbox method as it applies to the CanvasShapes object.
Adds a text box to a drawing canvas. Returns a Shape object that represents the text box and adds it to the CanvasShapes collection.
expression.AddTextbox(Orientation, Left, Top, Width, Height)
expression Required. An expression that returns a CanvasShapes object.
MsoTextOrientation
MsoTextOrientation can be one of these MsoTextOrientation constants. |
msoTextOrientationDownward |
msoTextOrientationHorizontal |
msoTextOrientationHorizontalRotatedFarEast |
msoTextOrientationMixed |
msoTextOrientationUpward |
msoTextOrientationVertical |
msoTextOrientationVerticalFarEast |
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.
AddTextbox method as it applies to the Shapes object.
Adds a text box to a document. Returns a Shape object that represents the text box and adds it to the Shapes collection.
expression.AddTextbox(Orientation, Left, Top, Width, Height, Anchor)
expression Required. An expression that returns one of the objects in the Applies to list.
MsoTextOrientation
MsoTextOrientation can be one of these MsoTextOrientation constants. |
msoTextOrientationDownward |
msoTextOrientationHorizontal |
msoTextOrientationHorizontalRotatedFarEast |
msoTextOrientationMixed |
msoTextOrientationUpward |
msoTextOrientationVertical |
msoTextOrientationVerticalFarEast |
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.
Anchor Optional Variant. A Range object that represents the text to which the text box is bound. 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.
Example
As it applies to the CanvasShapes object.
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
As it applies to the Shapes object.
This example adds a text box that contains the text "Test" to a new document.
Sub newTextbox()
Dim docNew As Document
Dim newTextbox As Shape
'Create a new document and add a text box
Set docNew = Documents.Add
Set newTextbox = docNew.Shapes.AddTextbox _
(Orientation:=msoTextOrientationHorizontal, _
Left:=100, Top:=100, Width:=300, Height:=200)
'Add text to the text box
newTextbox.TextFrame.TextRange = "Test"
End Sub
Applies to | CanvasShapes Collection | Shapes Collection Object
See Also | CreateTextbox Method | TextFrame Object