OLEClass Property

Visual Studio .NET 2003

Returns the named class ID of an OLE object. Read-only at design time and run time for an existing object, but can be set for an object when creating it.

Control.OLEClass[ = cName]

Property Values

The named class ID of the object. This is the registered name of the application that was used to create the object or will be invoked if the object is activated.


You set OLEClass property of an OLE container object using the Insert Object dialog box when you initially add an OLE container to a form, or in code when creating an OLE object as part of a class definition. This property is also set when you create OLE objects using the APPEND GENERAL command.

The OLEClass property of an object specifies the application that is used to create or edit the OLE object. To specify the actual contents of the object, set its DocumentFile property.


The following example adds an OLE Container control to a form, and uses the OLEClass and DocumentFile properties to specify Microsoft Excel as the Automation server and an Excel worksheet as the file to edit.

Define class myForm as form
 add object oleXLSheet1 as oleXLSheet

Define class oleXLSheet as OLECONTROL
 oleclass = "Excel.Sheet"
 oletypeallowed = 1  && Embedded

See Also

APPEND GENERAL | CREATEOBJECT( ) | DocumentFile Property

Applies To: OLE Bound Control | OLE Container Control