Python, COM and Excel

Mark Hammond mhammond at skippinet.com.au
Mon Nov 15 17:15:04 EST 1999


charliehubbard76 at yahoo.com wrote in message <80ps42$kkk$1 at nnrp1.deja.com>...
>Hello,
>
>I'm trying to write a python script to take an excel
>workbook and turn it into html pages.  I'm trying to
>automate this process, but I can't seem to get the
>bounds of the selection through com.  I can get the
>contents of a selection with
>
>app = Dispatch(Excel.Application)
>app.Selection()
>
>But this just gives me the data contained with the cells.

Yes.  "app.Selection" is a range object.  Making a "call" on this object
returns the data in the range (ie, the "Value" property on the range object)

Try:
>>> app.Selection.Address
'$A$1:$C$5'

>I want to be able to check fonts, bold, and format
>information of each cell to get it as close to the excel
>formatting as possible.  In order to do this I need to

>>> app.Selection.Font.Name
'Arial'
>>>

etc.

Mark.






More information about the Python-list mailing list