次の方法で共有


OLEClass Property

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]

Return Value

  • cName
    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.

Remarks

Applies To: OLE Bound Control | OLE Container Control

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.

Example

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
EndDefine

Define class oleXLSheet as OLECONTROL
 oleclass = "Excel.Sheet"
 documentfile="C:\msoffice\Excel\mysheet.xls"
 oletypeallowed = 1  && Embedded
EndDefine

See Also

Reference

APPEND GENERAL Command

CREATEOBJECT( ) Function

DocumentFile Property

Other Resources

Properties (Visual FoxPro)