Share via


Shapes.AddFormControl Method

Creates a Microsoft Excel control. Returns a Shape object that represents the new control.

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

Syntax

'Declaration
Function AddFormControl ( _
    Type As XlFormControl, _
    Left As Integer, _
    Top As Integer, _
    Width As Integer, _
    Height As Integer _
) As Shape
'Usage
Dim instance As Shapes
Dim Type As XlFormControl
Dim Left As Integer
Dim Top As Integer
Dim Width As Integer
Dim Height As Integer
Dim returnValue As Shape

returnValue = instance.AddFormControl(Type, _
    Left, Top, Width, Height)
Shape AddFormControl(
    XlFormControl Type,
    int Left,
    int Top,
    int Width,
    int Height
)

Parameters

  • Type
    Type: Microsoft.Office.Interop.Excel.XlFormControl

    Required XlFormControl. The Microsoft Excel control type. You cannot create an edit box on a worksheet. Can be one of these XlFormControl constants:

    xlButtonControl

    xlCheckBox

    xlDropDown

    xlEditBox

    xlGroupBox

    xlLabel

    xlListBox

    xlOptionButton

    xlScrollBar

    xlSpinner

  • Left
    Type: System.Int32

    Required Integer. The initial coordinates of the new object (in points) relative to the upper-left corner of cell A1 on a worksheet or to the upper-left corner of a chart.

  • Top
    Type: System.Int32

    Required Integer. The initial coordinates of the new object (in points) relative to the upper-left corner of cell A1 on a worksheet or to the upper-left corner of a chart.

  • Width
    Type: System.Int32

    Required Integer. The initial size of the new object, in points.

  • Height
    Type: System.Int32

    Required Integer. The initial size of the new object, in points.

Return Value

Type: Microsoft.Office.Interop.Excel.Shape

Remarks

Use the AddOLEObject method or the Add method of the OLEObjects collection to create an ActiveX control.

See Also

Reference

Shapes Interface

Shapes Members

Microsoft.Office.Interop.Excel Namespace