Re: python win32com excel problem

2007-05-01 Thread NO_SPAM
Bart Willems wrote: > Ray wrote: >> Hi, >> I tried to call "xlApp.Columns.AutoFit=1" the whole program will crash, >> but without xlApp.Columns.AutoFit=1, everything just fine. > > Autofit is a method. Also, columns are a method of a worksheet - try: > xlApp.Worksheets.Columns("C:K").Autofit() > (

Re: python win32com excel problem

2007-05-01 Thread Bart Willems
Bart Willems wrote: > Autofit is a method. Also, columns are a method of a worksheet - try: > xlApp.Worksheets.Columns("C:K").Autofit() Silly me. That is of course xlApp.Activesheet.Columns("C:K").Autofit() On a sidenote, you can refer to a worksheet with xlApp.Worksheets(Name) as well. -- http

Re: python win32com excel problem

2007-05-01 Thread Bart Willems
Ray wrote: > Hi, > I tried to call "xlApp.Columns.AutoFit=1" the whole program will crash, > but without xlApp.Columns.AutoFit=1, everything just fine. Autofit is a method. Also, columns are a method of a worksheet - try: xlApp.Worksheets.Columns("C:K").Autofit() (or whatever columns you need of c

python win32com excel problem

2007-05-01 Thread Ray
Hi, I'm working on something with mysql and excel. I'm using python and win32com. All major function works, But I have two problems: 1. the output need to do "auto fit" to make it readable. I tried to call "xlApp.Columns.AutoFit=1" the whole program will crash, but without xlApp.Columns.AutoFit