CreateObject(ProgId: String): Variant;
ProgId. Programmatic identifier of the application, which instance must be created.
The CreateObject method creates an application instance according to the specified programmatic identifier.
Programmatic identifier specified in the ProgId parameter can be obtained from the operating system registry: the global universal identifier of created application must be found in the HKEY_CLASSES_ROOT\CLSID section. The application name is a default value for the section of a global unique identifier. Found section contains the ProgID subsection, which default value is the programmatic identifier of the application.
Sub UserProc;
Var
Excel, Sheet: variant;
a: Array;
Begin
Excel := Variant.CreateObject("Excel.Application");
Excel.GetProperty("Workbooks").Invoke("Add", a);
Sheet := Excel.GetPropertyEx("Sheets", 1);
a := New Variant[2];
a[0] := Sheet.GetPropertyEx("Cells", 1, 1);
a[1] := Sheet.GetPropertyEx("Cells", 5, 5);
Sheet.SetPropertyEx("Range", a, 99);
Excel.SetProperty("Visible", True);
End Sub UserProc;
After executing the example the Excel application is created. A new workbook is added. After this the value "99" is set for the first sheet into the cell range (1,1,5,5). Then the application becomes visible.
See also: