A variable to hold the reference to the instantiated object
The programmatic identifier (or ProgID) of the class of the object to create
The name of the server on which the object resides
A reference to a COM or ActiveX object
Creates an instance of an OLE Automation (ActiveX) object.
Prior to calling the methods, functions, or properties of a COM or ActiveX object, you are required to create an instance of that object. Once an object is created, reference it in code using the object variable you defined.
If your project does not include a reference to the object, you must declare the object variable type as Object; this allows the variable to reference any type of object.
If an instance of the ActiveX object is already running, CreateObject may start a new instance when it creates an object of the required type.
CreateObject can only be used to create instances of COM (or ActiveX) objects; it cannot be used to instantiate .NET components.
The following routine defines a generic Object variable, as well as an Excel application object. It then uses the Timer function to compare the performance of the code fragment that uses late binding to instantiate the Excel application object with the one that uses early ...