Share via


Shapes.AddShape Method

Returns a Shape object that represents the new AutoShape in a worksheet.

Namespace:  Microsoft.Office.Interop.Excel
Assembly:  Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)

Syntax

'Declaration
Function AddShape ( _
    Type As MsoAutoShapeType, _
    Left As Single, _
    Top As Single, _
    Width As Single, _
    Height As Single _
) As Shape
'Usage
Dim instance As Shapes
Dim Type As MsoAutoShapeType
Dim Left As Single
Dim Top As Single
Dim Width As Single
Dim Height As Single
Dim returnValue As Shape

returnValue = instance.AddShape(Type, _
    Left, Top, Width, Height)
Shape AddShape(
    MsoAutoShapeType Type,
    float Left,
    float Top,
    float Width,
    float Height
)

Parameters

  • Left
    Type: System.Single

    Required Single. The position (in points) of the upper-left corner of the AutoShape's bounding box relative to the upper-left corner of the document.

  • Top
    Type: System.Single

    Required Single. The position (in points) of the upper-left corner of the AutoShape's bounding box relative to the upper-left corner of the document.

  • Width
    Type: System.Single

    Required Single. The width and height of the AutoShape's bounding box, in points.

  • Height
    Type: System.Single

    Required Single. The width and height of the AutoShape's bounding box, in points.

Return Value

Type: Microsoft.Office.Interop.Excel.Shape

Remarks

To change the type of an AutoShape that you’ve added, set the AutoShapeType property.

See Also

Reference

Shapes Interface

Shapes Members

Microsoft.Office.Interop.Excel Namespace