Using IDispatch to access exposed OLE Automation objects involves the following steps:
1. Initialize OLE using the OleInitialize function.
2. Create an instance of the object you wish to access using the CoCreateInstance function.
If the object's application is not yet running, OLE starts it and initializes the object. Note that if OLE starts the application, it may not be visible. With Microsoft Excel, you must set the Visible property for the application to make it visible.
3. Obtain a reference to the object's IDispatch interface using the QueryInterface member function.
With Microsoft Excel, you can combine steps 2 and 3 and obtain the IDispatch reference directly from the CoCreateInstance function.
4. Use the GetIDsOfNames member function to obtain the DISPID values for the desired method or property exposed in the object's IDispatch interface.
5. Use the Invoke member function to access the method or property.
6. Terminate the object by invoking the appropriate method in its IDispatch interface.
7. Uninitialize OLE, using the OleUninitialize function.
Complete information about accessing OLE Automation objects appears in Chapter 3 in Volume 2 of the OLE 2 Programmer's Reference.