微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Excel 加载项:在编辑单元格时延迟执行 - 不工作

如何解决Excel 加载项:在编辑单元格时延迟执行 - 不工作

我编写了以下代码,它调用选定的函数并放入选定的单元格。 我用过 delay execution of a custom function till user exits the cell。但这是行不通的。功能正在执行,无需等待用户确认。以下是我的代码

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);
 }
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。