Constants from Excel?

Chetan Gadgil cgadgil_list at cxoindia.dnsalias.com
Thu Feb 26 01:26:10 EST 2004


http://aspn.activestate.com/ASPN/docs/ActivePython/2.3/PyWin32/html/com/
win32com/HTML/QuickStartClientCom.html#UsingComConstants


"""
Using COM Constants
Makepy automatically installs all generated constants from a type
library in an object called win32com.clients.constants. You do not need
to do anything special to make these constants work, other than create
the object itself (ie, in the example above, the constants relating to
Word would automatically be available after the
w=win32com.client.Dispatch("Word.Application") statement.

For example, immediately after executing the code above, you could
execute the following:

>>> w.WindowState = win32com.client.constants.wdWindowStateMinimize

and Word will Minimize.
"""


Chetan


`I know what you're thinking about,' said Tweedledum: `but it isn't so,
nohow.'
    -- Lewis Carroll, Through the Looking Glass


> -----Original Message-----
> From: 
> python-list-bounces+cgadgil_list=cxoindia.dnsalias.com at python.
> org 
> [mailto:python-list-bounces+cgadgil_list=cxoindia.dnsalias.com
> @python.org] On Behalf Of Tim Roberts
> Sent: Thursday, February 26, 2004 11:39 AM
> To: python-list at python.org
> Subject: Constants from Excel?
> 
> 
> I've done a lot of COM work from Python, including control of 
> the Office applications.  However, I have a question that 
> I've never been able to answer.
> 
> Is there a way to programmatically fetch the values of COM 
> constants?  For example, in my Excel apps, I have a section 
> like this, that I have gleaned from multiple Google posts:
> 
>   xlPortrait = 1   # orientation constants
>   xlLandscape = 2
>   xlWKS = 4        # SaveAs format constants
>   xlExcel9795 = 43
>   xlHAlignRight = -4152
>   xlHAlignCenter = -4108
> 
> This works, but it'd be nicer to create an instance of, say, 
> Excel.Constants and pull the values from there.
> -- 
> - Tim Roberts, timr at probo.com
>   Providenza & Boekelheide, Inc.
> -- 
> http://mail.python.org/mailman/listinfo/python-list
> 





More information about the Python-list mailing list