JavaScript Editor js editor     Web development 

Main Page

Activates an Automation object and creates a reference to the object.

GETOBJECT(cFileName | Moniker [, cClassName])



Specifies the full path and name of the file to activate. The application does not need to be specified, because the OLE dynamic link libraries determine the application to start based on the file name you provide. For example, the following code launches Microsoft Excel, opens a file named BUDGET.XLS, and creates a reference through an object variable named MBUDVAR:
В Copy Code

The identifier of a COM object that implements the IMoniker interface. A moniker can be any of the following types: file, item, generic composite, anti-, pointer, and URL. For details about COM monikers, search for "IMoniker" on the Microsoft Developer Network.

Specifies the class name of the object to retrieve. Some applications can store more than one object type in the same file, making it possible for you to use the class name to specify the object to activate. For example, if a word processing application stores its documents, macro definitions, and ToolBar objects in the same file, you can create a reference to the document file with the following command:
В Copy Code
With some server applications, each time you issue GETOBJECT(В ), an additional instance of the application is started, using additional memory. If the application is already running, you can prevent additional instances of the application from starting by omitting FileName and including ClassName, as in this example:
В Copy Code
oleApp = GETOBJECT(, "Excel.Application")


Object reference


Use GETOBJECT(В ) to activate an Automation object from a file and to assign a reference to the object through a memory variable or array element.

If you specify an invalid file or class name, an OLE error is displayed, and the GETOBJECT(В ) function returns an empty string.


For example, on a network that has implemented Active Directory Services, you can query the network for information on a particular user.

В Copy Code
   *  Replace "DomainName" with the domain name, and "UserLoginID"
   *  with the login ID of the user you are looking up.
   oUser = GetObject("WinNT://DomainName/UserLoginID,user")
   ? oUser.FullName

See Also

JavaScript Editor js editor     Web development