Share via


Shapes.AddLabel Method

Excel Developer Reference

Creates a label. Returns a Shape object that represents the new label.

Syntax

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

expression   A variable that represents a Shapes object.

Parameters

Name Required/Optional Data Type Description
Orientation Required MsoTextOrientation The text orientation within the label.
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.

Return Value
Shape

Example

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

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

See Also