我想使用苹果脚本在excel 2011中创建一个包含多个系列的图表。
tell application "Microsoft Excel"
tell worksheet "Sheet1" of active workbook
set obj to make new chart object at end with properties {left position:20, top:88, width:33, height:90}
set ochart to chart of obj
set chart type of ochart to column clustered
set series 1 of series collection to ochart
tell series 1
set xvalues to "=Sheet1!$B$7:$B$10"
set name to "shartseries1"
end tell
end tell
end tell
在此脚本中创建图表并成功设置图表类型,但不创建图表系列。
答案 0 :(得分:1)
尝试:
tell application "Microsoft Excel"
tell worksheet "Sheet1" of active workbook
set obj to make new chart object at end with properties {left position:20, top:88, width:33, height:90}
set ochart to chart of obj
tell ochart
set chart type to column clustered
set newSeries to make new series at end with properties {series values:"=Sheet1!$B$7:$B$10", xvalues:"=Sheet1!$B$7:$B$10", name:"shartseries1"}
end tell
end tell
end tell