IOleDocumentBox.CreateObject

Syntax

CreateObject(ClassName: String);

Parameters

ClassName. Program identifier of the created COM object.

Description

The CreateObject method creates an instance of the specified COM object and places it to the component.

Comments

An application program identifier, specified in the ClassName parameter, can be obtained from the register of operating system: find the global unique identifier of the created COM object in the HKEY_CLASSES_ROOT\CLSID section. The name of COM object is the default value for the section of the global unique identifier. The ProgID subsection is located in the found section, which default value is an application program identifier.

The CreateObject method is applied only for the COM objects that has no personal window.

NOTE. On dynamic creation of the OleDocumentBox component, the CreateObject method can be used only after the Parent property is defined for the component.

Example

Executing the example requires a form, a button named Button1 positioned on it and the OleDocumentBox component.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);

Begin

OleDocumentBox1.CreateObject("Excel.Sheet.8");

End Sub Button1OnClick;

On pressing the button, the Microsoft Excel sheet is created and loaded in the OleDocumentBox.

See also:

IOleDocumentBox