How to call COM constants and global functions?

Gonçalo Rodrigues op73418 at mail.telepac.pt
Mon Feb 25 14:34:11 EST 2002


On 25 Feb 2002 11:26:26 -0800, newgene at bigfoot.com (newgene) wrote:

>Hi, group,
>     Recently, I tried to integrate python with excel by using
>win32com module, but I don't know how to call a constants in VB for
>Excel, like 'xlCSV' for 'XlFileFormat', 'xlBackgroundAutomatic' for
>'XlBackground',etc. Also, I don't know how to call a global function
>like "RGB".
>     Hope you can help me out.
>
>PS. When I follow the code in "Python programming on win32" Page
>206-207(Using COM constants), it doesn't work for me. The code is :
>
>>>> from win32com.client import constants, Dispatch
>>>> xl=Dispatch("Excel.Application")
>>>> constants.xlAscending
>Traceback (most recent call last):
>  File "<interactive input>", line 1, in ?
>  File "C:\Python22\win32com\client\__init__.py", line 133, in
>__getattr__
>    raise AttributeError, a
>AttributeError: xlAscending
>
>My platform is ActivePython 2.2a2+ on Win2K.
>

As far as i remember from the same book you have to run makepy on the
excel library to have acess to the constants.

Hope it helps,
Gonçalo Rodrigues

>
>Thanks.
>
>CL




More information about the Python-list mailing list