[python-win32] Silly com question really. Geting a value back

Mark Ainsworth MarkA@sundance.com
Wed, 22 May 2002 10:35:43 +0100


I'm sorry if this seems trivial, and the answer is probably very simple for
those of you who know. Unfortunately I'm not one of you yet. I am trying to
get the value of a comments field in an excel spreadsheet. No matter what I
try though I just keep on getting the bound object, rather than the object
value. Can someone please tell me the simple answer.

Thanks.

from win32com.client import Dispatch
xlApp = Dispatch("Excel.Application")
xlBook = xlApp.Workbooks.Open("product status v13 -
internal.xls",0,1,1,"password")
st = str(xlBook.Sheets("Modules").Range("a4").Comment.Text)
print st
<bound method Comment.Text of <win32com.gen_py.Microsoft Excel 9.0 Object
Library.Comment>>

I don't want to know this. I want to see the contents of the comment field
:-S

Mark Ainsworth
Quality Manager
Sundance Multiprocessor Technology Ltd.
Chiltern House, Waterside, Chesham, Bucks HP5 1PS
Tel. +44 1494 793167 Fax. +44 1494 793168
MarkA@sundance.com http://www.sundance.com