Shapes.AddLabel method (Excel)

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 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.

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

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.