如何在使用Apple脚本在Excel中创建图表后更改系列名称。

时间:2012-10-22 03:21:48

标签: excel applescript

我的下一个问题是如何以这种方式更改系列名称。

1)

 tell application "Microsoft Excel"
         tell worksheet "Sheet1" of active workbook
            set obj to make new chart object at end with properties {name:"chart1",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:"tempSeriesName"}
           end tell
         end tell
      end tell 

2)

tell the chart of sheet "chart1"     
             tell series1       
                 set name to "chartseries1"                       
            end tell                 
     end tell  

在此脚本中,第一个脚本成功运行,但第二个脚本未更改第一个系列的名称。 请回复我等你重播。

1 个答案:

答案 0 :(得分:0)

尝试:

tell application "Microsoft Excel"
    tell worksheet "Sheet1" of active workbook
        set name of first series of chart of chart object 1 to "chartseries1"
    end tell
end tell