2012-10-16 24 views
0

我想使用apple脚本在excel 2011中创建多个系列的图表。如何使用apple脚本在excel中创建多个系列

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 

在此脚本图表中创建并且图表类型设置成功,但未创建图表系列。

回答

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 
+0

嗨,如果一系列的价值是“= {1}”,那么脚本就是通过错误即“Microsoft Excel中得到了一个错误:无法使类系列”。请使用属性{系列值:“= {1}”}设置新系列,以便制作新系列,请重播 – user1705318

相关问题