COM and win32 - casting com to string

Ignacio Vazquez-Abrams ignacio at openservices.net
Wed Oct 3 03:30:59 EDT 2001


On Wed, 3 Oct 2001, Paul Brian wrote:

> I am trying to automate excel, and have been relatively successful.
> I can start up a python com client from win32 extentions and bring up excel
> as a server. (I hope I got that the right way round :-)
>
> I can then identify "named ranges" in excel (a group of cells that I
> previously told excel to keep track of)
>
> the code:
>     x = excelAppl.ActiveWorkBook.Names
>     for namerange in x:
>         print namerange
> gives me my two ranges back:
> =Sheet1!$D$3:$G$3
> =Sheet1!$D$4:$D$7
>
> all I want to do know is split those into the sheet1 and the $D$3....
>
> however the two results are not python instances but
> <COMObject <unknown>>
>
> I cannot perform string operations, repr does not help and type() just tells
> me they are "instances" - can anyone tell me what I am doing wrong.
> I expect I am not understanding something about com / win32.

Does str() have any effect?

-- 
Ignacio Vazquez-Abrams  <ignacio at openservices.net>





More information about the Python-list mailing list