Table of contents
TOC
Collapse the table of content
Expand the table of content

Shapes.AddTextbox Method (Publisher)

office 365 dev account|Last Updated: 8/24/2017
|
3 Contributors

Adds a new Shape object representing a text box to the specified Shapes collection.

Syntax

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

_expression_A variable that represents a Shapes object.

Parameters

NameRequired/OptionalData TypeDescription
OrientationRequiredPbTextOrientationThe orientation of the text box.
LeftRequiredVariantThe position of the left edge of the shape representing the text box.
TopRequiredVariantThe position of the top edge of the shape representing the text box.
WidthRequiredVariantThe width of the shape representing the text box.
HeightRequiredVariantThe height of the shape representing the text box.

Return Value

Shape

Remarks

For the Left, Top, Width, and Height parameters numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

The Orientation parameter can be one of the PbTextOrientation constants declared in the Microsoft Publisher type library and shown in the following table.

ConstantDescription
pbTextOrientationHorizontalA horizontal text box for left-to-right languages.
pbTextOrientationRightToLeftA horizontal text box for right-to-left languages. This value has no effect if a right-to-left language is not selected.
pbTextOrientationVerticalEastAsiaA vertical text box for East Asian languages. If a non-East Asian language is selected, text appears rotated 90 degrees to the right.

Example

The following example adds a new horizontal text box to the first page of the active publication.

Dim shpTextBox As Shape 

Set shpTextBox = ActiveDocument.Pages(1).Shapes.AddTextBox _ 
 (Orientation:=pbTextOrientationHorizontal, _ 
 Left:=144, Top:=144, _ 
 Width:=72, Height:=18) 
© 2018 Microsoft