Python, COM & Excel

Gillou nospam at bigfoot.com
Mon Jan 20 18:06:10 CET 2003


"Brandon Beck" <bbeck at NOSPAM.austin.rr.com> a écrit dans le message de news:
6orW9.65051$Pb.2682414 at twister.austin.rr.com...
> I find the best way to figure out exactly what COM calls you need to
> make, is to have a sample spreadsheet of the report you want to
> generate, and record macros of yourself doing the actions you want your
> report to automatically do.  Once you're done, go look at the generated
> VBA code, and the functions that are being called.  There is usually a
> 1:1 correspondence between those functions and the ones you need to call
> via COM from python.  I also tend to try to avoid using the ActiveSheet
> or ActiveWindow objects.  I haven't ever found a need for them given
> that my python scripts usually always know exactly which worksheet
> they're dealing with.

There's a better way to get the objects/methods exposed from an Excel COM
object :
Look at the help of Excel :
Programmer information>Visual Basic reference > Microsoft Excel objects
All you need is translating VB API to Python.

--Gilles







More information about the Python-list mailing list