Expand Minimize

WorksheetBase.OLEObjects Method

Gets an object that represents either a single OLE object (an Microsoft.Office.Interop.Excel.OLEObject) or a collection of all OLE objects (an Microsoft.Office.Interop.Excel.OLEObjects collection) on the worksheet.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

public Object OLEObjects(
	Object index
)

Parameters

index
Type: System.Object

The name or number of the OLE object.

Return Value

Type: System.Object
An object that represents either a single OLE object (an Microsoft.Office.Interop.Excel.OLEObject) or a collection of all OLE objects (an Microsoft.Office.Interop.Excel.OLEObjects collection) on the worksheet.

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

The following code example uses the OLEObjects method to display the number of OLE objects in the current worksheet.

This example is for a document-level customization.

private void DisplayOLEObjectsCount()
{
    Excel.OLEObjects oleObjects1 = (Excel.OLEObjects)this.OLEObjects();
    MessageBox.Show("There are " + oleObjects1.Count + " OLE objects in " +
        "this worksheet.");
}

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft