he Dispatch object exposes the COM IDispatch interface behind a given object.
It provides means to control objects in a situation when a COM part of the
Excel API has been omitted in the PFE implementation.
For example, let us consider the following workbook.
The PFE presently does not have direct support for charts. We are going to
show how one would change the data source range for the given chart using the
PFE. The following VBA macro was recorded. It changes the data source from the
range F2:F12 to the range G2:G12.
Such code provides a solid start for experimentation with the Dispatch object
returned by the Dispatch method of the Application object. Additional
information may be obtained from the COM/OLE Object Viewer under Type
We use the VBA code as the source of names and the OLE Viewer as the source of
precise signature information. The following code performs the task.
The IDispatch-based programming and COM/OLE Viewer are covered in details in
the book "Developer's Workshop to COM and ATL 3.0" by Andrew Troelsen.