"Ransom" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Very newb here, but my question will hopefully be obvious to someone. <snip> > But when I try and put the output from the spreadsheet into > a dynamic list after the TODO section thusly: > > outputlist = [] > outputlist.extend(excel.ActiveSheet.Cells(32,6) > return outputlist > > I get an error like: > [<win32com.gen_py.Microsoft Excel 9.0 Object Library.Range instance at > 0x15450880>] >
1. First of all, this is not the code you are running. I know this because the unbalanced parens wont even compile. It really doesn't help when you ask for help, but post the wrong code. 2. What you are getting is NOT an error. Read it very carefully. What you have added to outputlist is a Range object. Look into the Excel COM documentation (you can open up VB from Excel by pressing Alt-F11, then open the Object Browser to see the object API) for how to access the methods and properties of an Excel Range. I'm guessing one of the properties Value, Value2, Text, or Formula will give you what you want. 3. The reason your print statement appears to work is because print implicitly applies the str method to objects, while applying the repr method to contents of a list. So "print excel.ActiveSheet.Cells(32,6)" will output "42" or whatever - for grins, try "print type(excel.ActiveSheet.Cells(32,6))" (taking care to insert enough parens :) ) All that is gold does not glitter, not all who wander are lost, don't judge a book by its cover, or a variable by its output, etc... -- Paul -- http://mail.python.org/mailman/listinfo/python-list