Bookshelf Home | Contents | Index | Search | PDF | ![]() ![]() ![]() ![]() |
Siebel eScript Language Reference > Siebel eScript Commands > The Global Object >
COMCreateObject() Method
COMCreateObject instantiates a COM object.
Syntax
COMCreateObject(objectName)
Returns
A COM object if successful; otherwise, undefined.
Usage
You should be able to pass any type of variable to the COM object being called; however, you must ascertain that the variable is of a valid type for the COM object. Valid types are strings, numbers, and object pointers.
NOTE: DLLs instantiated by this method must be Thread-Safe.
Example
This example instantiates Microsoft Excel as a COM object and makes it visible:
var ExcelApp = COMCreateObject("Excel.Application");
var bb = ExcelApp.visible = true;
//Make Excel visible through the Application object.
// Place some text in the first cell of the sheet
ExcelApp.ActiveSheet.Cells(1,1).Value = "Column A, Row 1";
// Save the sheet
var fileName = "C:\\demo.xls";
ExcelApp.SaveAs (fileName);
// Close Excel with the Quit method on the Application object
ExcelApp.Application.Quit();
// Clear the object from memory
ExcelApp = null;
}See Also
Bookshelf Home | Contents | Index | Search | PDF | ![]() ![]() ![]() ![]() |
Siebel eScript Language Reference Published: 18 April 2003 |