In Microsoft Access, you can create an Automation (formerly called OLE Automation) object either by using the New keyword to declare an object variable, or by using the CreateObject or GetObject function.
Microsoft Access supports Automation in two different ways. Microsoft Access is an COM component, meaning that you can access objects exposed by other applications and manipulate them from Microsoft Access, or from another application that supports Automation (formerly called OLE Automation), you can manipulate Microsoft Access objects.
Note Before you can use Microsoft Access or another application as a component, you must set a reference to that application's object library. For more information on setting references, search online Help for "setting references."
For example, if you are using Microsoft Access as a component, you can use Microsoft Excel objects. You do this by creating a new Microsoft Excel object from Microsoft Access and pointing an object variable to it. You can then set its properties and call its methods as you would for any object. You can create a new instance of the Microsoft Excel Application class in either of the following ways.
Dim appXL As New Excel.Application
' Or
Dim appXL As Excel.Application
Set appXL = CreateObject("Excel.Application")
If Microsoft Excel is already running, you can use the GetObject function to point an object variable to the current instance of the Microsoft Excel Application class.
Dim appXL As Excel.Application
Set appXL = GetObject( , "Excel.Application")
For more information about the Application object, search the help index for "Application object".
If you are using Microsoft Access as a component, you can manipulate Microsoft Access objects from another application. For example, you can open a Microsoft Access form from Microsoft Excel and use it to view data in a Microsoft Excel workbook. The following example creates a new Microsoft Access object from Microsoft Excel.
Dim appAccess As New Access.Application
If Microsoft Access is already running, use the GetObject function to point an object variable to the current instance of the Microsoft Access Application class.