Once you have referenced an application's object library you must create an instance of the application. This is just a fancy way of saying you need to start the other application programmatically so your code will have valid objects to work with.
Dim statement. You should qualify the type of application in your Dim statement. For example, this Dim statement declares an object variable of type Excel.Application:To do this, first declare a variable that will represent the other application. You do this the same way as built-in objects, by using a
Dim ExcelAppObj as Excel.Application
Set statement with the New keyword to set the variable equal to a running instance of the application. For example, the following Set statement sets the variable declared above equal to the Excel application. The New keyword starts a new session of Excel.After you declare the variable, use the
Set ExcelAppObj = New Excel.Application