Access CreateObject function

Syntax
CreateObject(class, [ servername ])

The CreateObject function syntax has these parts:

Code Examples
Every application that supports Automation provides at least one type of object. For example, a word processing application may provide an Application object, a Document object, and a Toolbar object. To create an ActiveX object, assign the object returned by CreateObject to an object variable. These examples explain how to connect Access to Excel Dynamically through VBA code: After an object is created, you reference it in code by using the object variable you defined. In the following example, you access properties and methods of the new object by using the object variable, ExcelSheet, and other Microsoft Excel objects, including the Application object and the Cells collection. Declaring an object variable with the As Object clause creates a variable that can contain a reference to any type of object. However, access to the object through that variable is late bound; that is, the binding occurs when your program is run. To create an object variable that results in early binding, that is, binding when the program is compiled, declare the object variable with a specific class ID. For example, you can declare and create the following Microsoft Excel references: The following code returns the version number of an instance of Excel running on a remote computer named MyServer: