Excel add-in : Delay execution while cell is being edited - not working

86 Views Asked by At

I've written the following code which invokes selected function and puts in a selected cell. I've used the delay execution of a custom function till user exits the cell. But this is not working. Function is executing with out waiting for user confirmation. Following is my code

async function run() {
 try {
      await Excel.run({ delayForCellEdit: true }, function (context) { 

      const currentCell = context.workbook.getActiveCell()

      // Read the range address
      currentCell.load("address");
      var totalFormulas = [["=NS.ADD"]];
      currentCell.values = totalFormulas;
      currentCell.format.autofitColumns();
      currentCell.select();
      return context.sync();
   });
 } catch (error) {
    console.error(error);
 }
}
0

There are 0 best solutions below