Siebel VB Language Reference > VB Language Reference >
This standard VB function returns a COM object associated with the file name or the application name.
The full path and filename for the object to retrieve
A string containing the class of the object
The object associated with pathname or the object associated with class.
Use GetObject with the Set statement to assign a variable to the object for use in a Basic procedure. The variable used must first be dimensioned as an object.
Syntax A of GetObject accesses a COM object stored in a file. For example, the following two lines dimension a variable as an object and assign the object
payables.xls to it.
Payables.xls is located in the
My Documents folder:
Dim oFileObject As Object
If the application supports accessing component objects within the file, you can append an exclamation point and a component object name to the file name, as follows:
As Object ComponentObject
GetObject("C:\My Documents\payables.xls!R1C1: R13C9")
Syntax B of GetObject accesses a COM object of a particular class that is stored in a file. Class uses the syntax appName.objectType, where appName is the name of the application that provides the object, and objectType is the type or class of the object. For example:
Dim oClassObject As Object
= GetObject("C:\My _
The third form of GetObject accesses the active COM object of a particular class. For example:
Dim oApplication As _
Set oApplication = _
If you use the third form of GetObject with a null string ("") as the pathname, a new object instance of the specified type is returned. Thus, the preceding example gets an open instance of the Siebel application, while
Set oApplication = _
instantiates the Siebel application in memory, independent of the user interface.
NOTE: The last two examples refer to the object SiebelAppServer, which has been defined as an object type as configured in your external Visual Basic environment.
This example opens a specific Excel worksheet and places the contents of the Name field of the active business component in it. The worksheet file must already exist.
Dim ExcelSheet As Object
Set ExcelSheet = GetObject("C:\demo\test.xls")
'Make Excel visible through the Application object.
ExcelSheet.Application.Visible = 1
'Place some text in the first cell of the sheet.
ExcelSheet.ActiveSheet.Cells(1, 1).Value = _
'Save the sheet.
'Close Excel with the Quit method on the Application object.