我不确定我的语法是否错误或者这是一个错误。

您希望能够使用以下方法创建具有常量的新系列:
set newSeries to make new series at end with properties {name:"tempSeriesName", series values:{50}}
但是,我只能使用一个范围来创建系列:
set newSeries to make new series at end with properties {name:"tempSeriesName", series values:"A2"}
但是,创建系列后,您可以使用以下命令更新值:
set series values to {50}
我的解决方法是在 A 列中找到第一个空白单元格并用一个值填充它。然后我使用此单元格创建范围,使用常量更新范围,然后将临时单元格恢复为空白。
tell application "Microsoft Excel"
tell worksheet "Sheet1" of active workbook
-- Find the first empty cell and populate it with 1
set counter to 0
repeat
set counter to counter + 1
set myRange to ("A" & counter as text)
if value of range myRange = "" then
set value of range myRange to "1"
exit repeat
end if
end repeat
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
-- create the chart with the temporary value
set newSeries to make new series at end with properties {name:"tempSeriesName", series values:myRange}
-- update the chart with your constant value
set series values of newSeries to {50}
end tell
set value of range myRange to ""
end tell
end tell
