Problem with COM and Excel

Pekka Niiranen krissepu at vip.fi
Tue Oct 2 15:56:06 EDT 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.

-pekka-





More information about the Python-list mailing list