COM and win32 - casting com to string

Paul Brian pbrian at demon.net
Wed Oct 3 03:00:00 EDT 2001


All,

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.
Any help gratefully recieved.


P Brian





More information about the Python-list mailing list