Article ID: 113946 - Last Review: July 1, 2004 - Revision: 2.1 How To Optimize OLE Server Instance Usage by Using GetObjectThis article was previously published under Q113946 On This PageSUMMARY
This article gives a full explanation of the syntax of GetObject, adding to
the information given in the "Programmer's Guide."
Specifically, this article explains when a new instance of the server application is instantiated, details how to best minimize server instance usage, and gives an example that shows how to best minimize excess instances of a server application. MORE INFORMATION
The GetObject function has two parameters:
The following table details the instance usage for the server application and gives the appropriate syntax: Server already running:
Syntax: Set X = GetObject(,"MySrvr.Object")
Server not running:
Result: X is reference to existing object Syntax: Set X = GetObject("","MySrvr.Object") Result: X is reference to new object
Syntax: Set X = GetObject(,"MySrvr.Object")
To establish a reference to an object and minimize the number of server
application instances loaded, use GetObject with a blank first argument,
and trap the error 429 when no instance is loaded. The following example
demonstrates this. The sample application uses Microsoft Excel version 5.0
as its server application.
Result: Error 429 Syntax: Set X = GetObject("","MySrvr.Object") Result: Server is started and X references new object Steps to Create Example Program
| Article Translations
|

Back to the top
