Visual Basic Reference

Visual Studio 6.0

Class Property

See Also    Example    Applies To

Returns or sets the class name of an embedded object.


object.Class [ = string]

The Class property syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
string A string expression specifying the class name.


A class name defines the type of an object. Applications that support ActiveX components fully qualify the class names of their objects using either of the following syntaxes:



The syntax for ActiveX component class names has the following parts:

Part Description
application The name of the application that supplies the object.
objecttype The object's name as defined in the object library.
version The version number of the object or application that supplies the object.

For example, Microsoft Excel version 5.0 supports a number of objects, including worksheets and charts. Their class names are Excel.Sheet.5 and Excel.Chart.5. Microsoft WordArt version 2.0 supports a single object with the class name MSWordArt.2.

Note   Some ActiveX component programming documentation refers to the class name syntax as a programmatic ID.

To view a list of class names available on your system, select the OLE container control, select the Class property in the Properties window, and then click the builder button.

Copying an object from the system Clipboard updates the controls Class property. For example, if you paste a Microsoft Excel chart from the system Clipboard into an OLE container control that previously contained a Microsoft Excel worksheet, its Class property setting changes from Excel.Sheet.5 to Excel.Chart.5. You can paste an object from the system Clipboard at run time with the Paste method or the PasteSpecialDlg method.