The OLEObjects Collection : Shape « Excel « VBA / Excel / Access / Word

The OLEObjects Collection

Public Sub AddCommandButton()
    ActiveSheet.Shapes.AddOLEObject(ClassType:="Forms.CommandButton.1").name = "cmdTest"
    With ActiveSheet.OLEObjects("cmdTest")
        .Left = range("C1").Left
        .Top = range("C4").Top
    End With
    ActiveSheet.OLEObjects("cmdTest").Object.Caption = "Click Me"
End Sub


Related examples in the same category

1.Get shape and output its z order
2.Draw a star
3.Create a shape and set its color
4.Delete a shape
5.Looping through a Collection of Shapes