0

Excel 2011 では、アップル スクリプトを使用して 1 つの余分なシリーズが作成されます。

   tell application "Microsoft Excel"
    make new workbook
    tell worksheet "sheet1" of active workbook
        set value of cell "A1" to 10
        set value of cell "B1" to 5
        set obj to make new chart object at end with properties {left position:100,      top:100, height:200, width:300, name:"MyChart"}
        set ochart1 to chart of chart object "MyChart"
        tell ochart1
            set chart type to bar clustered
            make new series at end with properties {series values:"=Sheet1!$A$1:$B$1", name:"2"}

        end tell
    end tell
end tell

私の問題、余分なシリーズ (シリーズ 1) がシート 1 に作成されます。

ここに画像の説明を入力

ここに画像の説明を入力

4

2 に答える 2

0

これは正しい方法ではないと確信していますが、仕事を終わらせる必要があります。

tell application "Microsoft Excel"
    make new workbook
    tell worksheet "sheet1" of active workbook
        set value of cell "A1" to 10
        set value of cell "B1" to 5
        set obj to make new chart object at end with properties {left position:100, top:100, height:200, width:300, name:"MyChart"}
        set ochart1 to chart of chart object "MyChart"
        tell ochart1
            set chart type to bar clustered
            make new series at end with properties {series values:"=Sheet1!$A$1:$B$1", name:"2"}
            delete (every series whose name ≠ "2")
        end tell
    end tell
end tell
于 2013-02-07T15:01:49.180 に答える
0

より意味のあるシリーズを作成すると、うまくいくようです。

tell application "Microsoft Excel"
    make new workbook
    tell worksheet "sheet1" of active workbook
        set value of cell "A1" to 2
        set value of cell "B1" to 3
        set value of cell "A2" to 4
        set value of cell "B2" to 6
        set value of cell "A3" to 10
        set value of cell "B3" to 5
        set obj to make new chart object at end with properties {left position:100, top:100, height:200, width:300, name:"MyChart"}
        set ochart1 to chart of chart object "MyChart"
        tell ochart1
            set chart type to bar clustered
            #remove  first series
            make new series at end with properties {series values:"=Sheet1!$A$1:$A$3", name:"one"}
            make new series at end with properties {series values:"=Sheet1!$B$1:$B$3", name:"two"}
        end tell
    end tell
end tell

注 - 単一のステートメントでそれぞれに名前を付ける方法がわからなかったため、シリーズを個別に作成しました。

于 2013-02-12T05:48:54.630 に答える