AddLabel Method

Microsoft PowerPoint Visual Basic

Show All

AddLabel Method

       

Creates a label. Returns a Shape 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. 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, measured in points, of the left edge of the label relative to the left edge of the slide.

Top   Required Single. The position, measured in points, of the top edge of the label relative to the top edge of the slide.

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

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

Example

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

Set myDocument = ActivePresentation.Slides(1)
myDocument.Shapes.AddLabel(Orientation:=msoTextOrientationVerticalFarEast, _
    Left:=100, Top:=100, Width:=60, Height:=150).TextFrame _
    .TextRange.Text = "Test Label"