0

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);
 }
}
madireddy
  • 107
  • 3
  • 13
  • I tested your code in Script Lab, the behavior is the same as loading an Excel function such as SUM(). When the cell is in an edit mode, the function will be delay execution. Could you please explain what's the meaning of waiting for user confirmation? – qinliuMSFT Mar 05 '21 at 06:04
  • Few of the custom functions are parameterised. Once the function is added to the cell, the expected behaviour is not to execute the function immediately, instead ask for the parameters data and once user confirms, then function should get executed. – madireddy Mar 05 '21 at 09:22

0 Answers0