views:

30

answers:

1

Hey!

I am using Excel 2011 v14 and trying to dynamically create a chart based on the selected range on my worksheet. To select a range, I use the following code segment:

xl = app('Microsoft Excel')
tcell = 'B'
qcell = 'C'

for r in xrange(2, 16):
    xl.cells[tcell + str(r)].value.set(r)
    xl.cells[qcell + str(r)].value.set(random.randint(2, 100))


xl.cells["B2:C15"].select()
xl.make(new=k.chart, at=xl.active_sheet)

but I got a blank chart on the active sheet. Any help will be appreciated.

A: 

As I suggested to someone else who had a similar question, you should sort out how to make this work in native Applescript first and then port to py-appscript. There is a lot that can go wrong in your code snippet and there could be (and usually are) errors being returned by Applescript that the framework doesn't carry all the way back to you.

Philip Regan