CreateObject(ClassName: String);
ClassName. Program identifier of the created COM object.
The CreateObject method creates an instance of the specified COM object and places it to the component.
An application program identifier specified in the ClassName parameter can be obtained from the operating system registry: 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 found section contains the ProgID subsection, which default value is the program identifier of the application.
The CreateObject method is applied only for windowless COM objects.
NOTE. On dynamic creation of the OleDocumentBox component, the CreateObject method can be used only after the Parent property is set for the component.
Executing the example requires a form, a button named Button1 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 to OleDocumentBox.
See also: