Using Python for client-side COM basically means using Python to access an application somebody else has written. There is little to learn about client-side COM per se; what matters is learning the object model of the application or library you want to use.
Excel has a large object model—about as complex as anything you
are likely to encounter. For example, just one of the objects,
, has 84 properties and 72 methods.
What’s more, it’s not particularly straightforward; the
Perl community’s mantra “There’s more than one way
to do it” probably applies even more to Excel than it does to
In Chapter 7, we stressed the importance of rerunning Office Setup to get the right help files. If you didn’t do it then, do it now. The key help file is the Microsoft Excel Visual Basic Reference, which covers the object model.
The easiest way to learn the Excel object model is to write programs in Visual Basic for Applications. The VB editor is available with every copy of Office and is a first-rate development environment. The following key features help a great deal in learning:
If you type
ActiveSheet into the editor, a list drops down
showing all the properties and methods of a
object. This saves an enormous amount of time learning the object
model (see Figure 9.1).