How to call COM constants and global functions?

newgene newgene at bigfoot.com
Mon Feb 25 14:26:26 EST 2002


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.


Thanks.

CL



More information about the Python-list mailing list