Problem with COM and Excel

Pekka Niiranen krissepu at
Tue Oct 2 21:56:06 CEST 2001

How can I run AutoFit to all columns of my Excel sheet from python ?

I have tried:

>>> xlApp = win32com.client.dynamic.Dispatch('Excel.Application')
>>> xlBook = xlApp.Workbooks.Add()
>>> sht = xlBook.Worksheets("Sheet1")
>>> xlApp.Visible = 1

So far so good, but at this stage I added some values to Excel Sheet
(manually) and then run:

>>> sht.Columns().AutoFit

The whole PC is jamming with harddisk running madly. I have to use task
manager to kill Idle and Excel.


More information about the Python-list mailing list