WorksheetBase.OLEObjects(Object) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets an object that represents either a single OLE object (an OLEObject) or a collection of all OLE objects (an OLEObjects collection) on the worksheet.
public object OLEObjects (object index);
member this.OLEObjects : obj -> obj
Public Function OLEObjects (Optional index As Object) As Object
Parameters
- index
- Object
The name or number of the OLE object.
Returns
An object that represents either a single OLE object (an OLEObject) or a collection of all OLE objects (an OLEObjects collection) on the worksheet.
Examples
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.");
}
Private Sub DisplayOLEObjectsCount()
Dim oleObjects1 As Excel.OLEObjects = _
CType(Me.OLEObjects(), Excel.OLEObjects)
MsgBox("There are " & oleObjects1.Count & " OLE objects in " & _
"this worksheet.")
End Sub
Remarks
Optional Parameters
For information on optional parameters, see Optional Parameters in Office Solutions.