Quantitative Analysis
Parallel Processing
Numerical Analysis
C++ Multithreading
Python for Excel
Python Utilities
Services
Author

I. Motivation and design (PFE).
II. Installation of the Python for Excel.
III. Tutorial introduction into the Python for Excel.
IV. PFE Programmer's reference.
1. Direct access to Excel API.
2. Lower level access to Excel API.
A. Dispatch object (PFE).
B. PyCObject object (PFE).
3. Event trapping (PFE).
4. Configuration files (PFE).
Index. Contents.

Dispatch object (PFE).


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.


Figure

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.


Figure

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 Libraries.


Figure


Figure


Figure

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.


Figure


Figure

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.





Index. Contents.


















Copyright 2007