Compartilhar via


OLEObjects Interface

A collection of all the OLEObject objects on the specified worksheet. Each OLEObject object represents an ActiveX control or a linked or embedded OLE object.

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

Syntax

'Declaration
<InterfaceTypeAttribute()> _
<GuidAttribute("000208A3-0000-0000-C000-000000000046")> _
Public Interface OLEObjects _
    Inherits IEnumerable
'Usage
Dim instance As OLEObjects
[InterfaceTypeAttribute()]
[GuidAttribute("000208A3-0000-0000-C000-000000000046")]
public interface OLEObjects : IEnumerable

Remarks

Use the OLEObjects method to return the OLEObjects collection.

Use the Add method to create a new OLE object and add it to the OLEObjects collection.

An ActiveX control on a sheet has two names: the name of the shape that contains the control, which you can see in the Name box when you view the sheet, and the code name for the control, which you can see in the cell to the right of (Name) in the Properties window. When you first add a control to a sheet, the shape name and code name match. However, if you change either the shape name or code name, the other is not automatically changed to match.

You use the code name of a control in the names of its event procedures. However, when you return a control from the Shapes or OLEObjects collection for a sheet, you must use the shape name, not the code name, to refer to the control by name. For example, assume that you add a check box to a sheet and that both the default shape name and the default code name are CheckBox1. If you then change the control code name by typing chkFinished next to (Name) in the Properties window, you must use chkFinished in event procedures names, but you still have to use CheckBox1 to return the control from the Shapes or OLEObjects collection.

See Also

Reference

OLEObjects Members

Microsoft.Office.Interop.Excel Namespace