OLEObject Object

Description

Represents an ActiveX control or a linked or embedded OLE object on a worksheet. The OLEObject object is a member of the OLEObjects collection. The OLEObjects collection contains all the OLE objects on a single worksheet.

Using the OLEObject Object

Use OLEObjects(index), where index is the name or number of the object, to return an OLEObject object. The following example deletes OLE object one on Sheet1.

Worksheets("Sheet1").OLEObjects(1).Delete
The following example deletes the OLE object named "ListBox1."

Worksheets("Sheet1").OLEObjects("ListBox1").Delete
Remarks

The properties and methods of the OLEObject object are duplicated on each ActiveX control on a worksheet. This enables Visual Basic code to gain access to these properties by using the control's name. The following example selects the check box control named "MyCheckBox," aligns it with the active cell, and then activates the control.

With MyCheckBox
    .Value = True
    .Top = ActiveCell.Top
    .Activate
End With
Properties

Application property, AutoLoad property, AutoUpdate property, Border property, BottomRightCell property, Creator property, Enabled property, Height property, Index property, Interior property, Left property, LinkedCell property, ListFillRange property, Locked property, Name property, Object property, OLEType property, Parent property, Placement property, PrintObject property, ProgId property, Shadow property, ShapeRange property, SourceName property, Top property, TopLeftCell property, Visible property, Width property, ZOrder property.

Methods

Activate method, BringToFront method, Copy method, CopyPicture method, Cut method, Delete method, Duplicate method, Select method, SendToBack method, Update method, Verb method.

Events

GotFocus event, LostFocus event.