Thanks for your response too! Unfortunately, I must have something messed up here because this didn't work either.
>>> from win32com.client import Dispatch, constants >>> print getattr(constants, 'xlHAlignRight', 'Bzzzzt!') Bzzzzt! >>> app = Dispatch('Excel.Application') >>> print getattr(constants, 'xlHAlignRight', 'Bzzzzt!') Bzzzzt! I tried running the makepy.py on the Excell 11.0 Object library and that fails on me as well. Any suggestions? -Jim -----Original Message----- From: John Machin [mailto:[EMAIL PROTECTED] Sent: Thursday, October 05, 2006 6:04 PM To: Jim Steil Cc: python-win32@python.org Subject: Re: [python-win32] Excel win32com newbie question On 6/10/2006 7:16 AM, Jim Steil wrote: > I've been working this week building some Excel spreadsheets using > Python and win32com. I am not having any trouble getting my sheets > built with the proper data in the proper cells, but I'm having a heck of > a time trying to find out how I can format my cells to make it look > nicer. I want to set it so most of the columns will resize themselves > to the proper width and I would like to adjust the alignment of some > columns. I've browsed through the last years worth of archives on this > mailing list and searched the web extensively but can't seem to find how > to get it to work. I've come across numerous examples of how to do some > things, but they don't seem to work on my machine. > > > > Possibly my biggest problem is that I can't get my machine to give me > the Excel constants. Here is the code I'm doing to try to test the > constants and the error I'm getting back. > > > > from win32com.client import constants, Dispatch > > > > x = constants.xlHAlignRight > > Traceback (most recent call last): > > File "<input>", line 1, in ? > > File "C:\Python24\Lib\site-packages\win32com\client\__init__.py", line > 168, in __getattr__ > > raise AttributeError, a > > AttributeError: xlHAlignRight > > > > I'm hoping there is something obvious that I'm missing. I think I can > find my way through the rest of my issues if I can just get by this > constants problem. Thanks for any help you can provide. > The constants module is a little bit more dynamic than one would normally expect: Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from win32com.client import Dispatch, constants >>> print getattr(constants, 'xlHAlignRight', 'Bzzzzt!') Bzzzzt! >>> app = Dispatch('Excel.Application') >>> print getattr(constants, 'xlHAlignRight', 'Bzzzzt!') -4152 >>> HTH, John _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32