ChartCollection Events


onActivated

Excel.run(function (context){ 
    context.workbook.worksheets.getActiveWorksheet()
        .charts.onActivated.add(function (event) {
        return Excel.run((context) => {
            console.log("The ID of the active chart is: " + event.chartId)
            return context.sync();
        });
    });
    return context.sync();
});

onAdded

Excel.run(function (context){ 
    context.workbook.worksheets.getActiveWorksheet()
        .charts.onAdded.add(function (event) {
        return Excel.run((context) => {
            console.log("A chart has been added with ID: " + event.chartId);
            return context.sync();
        });
    });
    return context.sync();
});

onDeactivated

Excel.run(function (context){ 
    context.workbook.worksheets.getActiveWorksheet()
        .charts.onDeactivated.add(function (event) {
        return Excel.run((context) => {
            console.log("The chart with this ID was deactivated: " + event.chartId);
            return context.sync();
        });
    });
    return context.sync();
});

onDeleted

Excel.run(function (context){ 
    context.workbook.worksheets.getActiveWorksheet()
        .charts.onDeleted.add(function (event) {
        return Excel.run((context) => {
            console.log("The chart with this ID was deleted: " + event.chartId);
            return context.sync();
        });
    });
    return context.sync();
});


© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited TopPrevNext