Shapes.AddOLEObject Method
Creates an OLE object. Returns a Shape object that represents the new OLE object.
Namespace: Microsoft.Office.Interop.Excel
Assembly: Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)
Syntax
'Declaration
Function AddOLEObject ( _
ClassType As Object, _
Filename As Object, _
Link As Object, _
DisplayAsIcon As Object, _
IconFileName As Object, _
IconIndex As Object, _
IconLabel As Object, _
Left As Object, _
Top As Object, _
Width As Object, _
Height As Object _
) As Shape
'Usage
Dim instance As Shapes
Dim ClassType As Object
Dim Filename As Object
Dim Link As Object
Dim DisplayAsIcon As Object
Dim IconFileName As Object
Dim IconIndex As Object
Dim IconLabel As Object
Dim Left As Object
Dim Top As Object
Dim Width As Object
Dim Height As Object
Dim returnValue As Shape
returnValue = instance.AddOLEObject(ClassType, _
Filename, Link, DisplayAsIcon, IconFileName, _
IconIndex, IconLabel, Left, Top, Width, _
Height)
Shape AddOLEObject(
Object ClassType,
Object Filename,
Object Link,
Object DisplayAsIcon,
Object IconFileName,
Object IconIndex,
Object IconLabel,
Object Left,
Object Top,
Object Width,
Object Height
)
Parameters
ClassType
Type: System.ObjectOptional Object. (you must specify either ClassType or FileName). A string that contains the programmatic identifier for the object to be created. If ClassType is specified, FileName and Link are ignored.
Filename
Type: System.ObjectOptional Object. The file from which the object is to be created. If the path isn’t specified, the current working folder is used. You must specify either the ClassType or FileName argument for the object, but not both.
Link
Type: System.ObjectOptional Object. True to link the OLE object to the file from which it was created. False to make the OLE object an independent copy of the file. If you specified a value for ClassType, this argument must be False. The default value is False.
DisplayAsIcon
Type: System.ObjectOptional Object. True to display the OLE object as an icon. The default value is False.
IconFileName
Type: System.ObjectOptional Object. The file that contains the icon to be displayed.
IconIndex
Type: System.ObjectOptional Object. The index of the icon within IconFileName. The order of icons in the specified file corresponds to the order in which the icons appear in the Change Icon dialog box (accessed from the Object dialog box when the Display as icon check box is selected). The first icon in the file has the index number 0 (zero). If an icon with the given index number doesn't exist in IconFileName, the icon with the index number 1 (the second icon in the file) is used. The default value is 0 (zero).
IconLabel
Type: System.ObjectOptional Object. A label (caption) to be displayed beneath the icon.
Left
Type: System.ObjectOptional Object. The position (in points) of the upper-left corner of the new object relative to the upper-left corner of the document. The default value is 0 (zero).
Top
Type: System.ObjectOptional Object. The position (in points) of the upper-left corner of the new object relative to the upper-left corner of the document. The default value is 0 (zero).
Width
Type: System.ObjectOptional Object. The initial dimensions of the OLE object, in points.
Height
Type: System.ObjectOptional Object. The initial dimensions of the OLE object, in points.
Return Value
Type: Microsoft.Office.Interop.Excel.Shape