This documentation is archived and is not being maintained.

OLEObjects.Add Method 

Adds a new OLE object to a sheet. Returns an OLEObject object.

Namespace: Microsoft.Office.Interop.Excel
Assembly: Microsoft.Office.Interop.Excel (in microsoft.office.interop.excel.dll)

'Usage
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 OLEObject
Dim oLEObjects1 As OLEObjects
returnValue = oLEObjects1.Add(ClassType, Filename, Link, DisplayAsIcon, IconFileName, IconIndex, IconLabel, Left, Top, Width, Height)

OLEObject Add(
	[In, Optional] object ClassType, 
	[In, Optional] object Filename, 
	[In, Optional] object Link, 
	[In, Optional] object DisplayAsIcon, 
	[In, Optional] object IconFileName, 
	[In, Optional] object IconIndex, 
	[In, Optional] object IconLabel, 
	[In, Optional] object Left, 
	[In, Optional] object Top, 
	[In, Optional] object Width, 
	[In, Optional] object Height
);
public OLEObject Add(
	/*in*/System.Object ClassType, 
	/*in*/System.Object Filename, 
	/*in*/System.Object Link, 
	/*in*/System.Object DisplayAsIcon, 
	/*in*/System.Object IconFileName, 
	/*in*/System.Object IconIndex, 
	/*in*/System.Object IconLabel, 
	/*in*/System.Object Left, 
	/*in*/System.Object Top, 
	/*in*/System.Object Width, 
	/*in*/System.Object Height
);
function Add(
	 ClassType : Object, 
	 Filename : Object, 
	 Link : Object, 
	 DisplayAsIcon : Object, 
	 IconFileName : Object, 
	 IconIndex : Object, 
	 IconLabel : Object, 
	 Left : Object, 
	 Top : Object, 
	 Width : Object, 
	 Height : Object
) : OLEObject;

Parameters

ClassType

Optional 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

Optional Object. (You must specify either ClassType or FileName.) A string that specifies the file to be used to create the OLE object.

Link

Optional Object. True to have the new OLE object based on FileName be linked to that file. If the object isn't linked, the object is created as a copy of the file. The default value is False.

DisplayAsIcon

Optional Object. True to display the new OLE object either as an icon or as its regular picture. If this argument is True, IconFileName and IconIndex can be used to specify an icon.

IconFileName

Optional Object. A string that specifies the file that contains the icon to be displayed. This argument is used only if DisplayAsIcon is True. If this argument isn't specified or the file contains no icons, the default icon for the OLE class is used

IconIndex

Optional Object. The number of the icon in the icon file. This is used only if DisplayAsIcon is True and IconFileName refers to a valid file that contains icons. If an icon with the given index number doesn't exist in the file specified by IconFileName, the first icon in the file is used.

IconLabel

Optional Object. A string that specifies a label to display beneath the icon. This is used only if DisplayAsIcon is True. If this argument is omitted or is an empty string (""), no caption is displayed.

Left

Optional Object. The initial coordinates of the new object in points, relative to the upper-left corner of cell A1 on a worksheet, or to the upper-left corner of a chart.

Top

Optional Object. The initial coordinates of the new object in points, relative to the upper-left corner of cell A1 on a worksheet, or to the upper-left corner of a chart.

Width

Optional Object. The initial size of the new object in points.

Height

Optional Object. The initial size of the new object, in points.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, and Windows 2000

Target Platforms

Show: