AddLabel Method

Microsoft Excel Visual Basic

object that represents the new label.

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

expression    Required. An expression that returns one of the objects in the Applies To list.

Orientation   Required MsoTextOrientation. The text orientation within the label.

MsoTextOrientation can be one of these MsoTextOrientation constants.
msoTextOrientationDownward
msoTextOrientationHorizontal
msoTextOrientationHorizontalRotatedFarEast
msoTextOrientationMixed
msoTextOrientationUpward
msoTextOrientationVertical
msoTextOrientationVerticalFarEast

Some of these 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 (in points) of the upper-left corner of the label relative to the upper-left corner of the document.

Top    Required Single. The position (in points) of the upper-left corner of the label relative to the top corner of the document.

Width Required Single. The width of the label, in points.

Height    Required Single. The height of the label, in points.

Example

This example adds a vertical label that contains the text "Test Label" to myDocument.

Set myDocument = Worksheets(1)
myDocument.Shapes.AddLabel(msoTextOrientationVertical, _
    100, 100, 60, 150) _
    .TextFrame.Characters.Text = "Test Label"