【问题标题】:How to cancel the close event for PowerPoint like in Word & Excel in PIA?如何在 PIA 的 Word 和 Excel 中取消 PowerPoint 的关闭事件?
【发布时间】:2010-10-14 17:21:01
【问题描述】:

当 Microsoft Word 关闭时,关闭事件可以取消。 Excel 也是如此。

但 PowerPoint 关闭事件没有取消标志。

是否可以通过其他方式取消活动?

【问题讨论】:

    标签: powerpoint


    【解决方案1】:

    在关闭事件中,您可以将文档设置为Saved = False,这将强制 PowerPoint 询问用户是否要使用“是-否-取消”消息框保存文件。

    在事件结束前使用SendKeys({ESC}),它将向消息框发送转义,关闭事件将被取消。

    【讨论】:

      【解决方案2】:

      示例:[不适用于 PP2003]

      using MSPowerPoint = Microsoft.Office.Interop.PowerPoint;
      using MSOffice = Microsoft.Office.Core;
      
      protected virtual void AppEvents_PresentationClose(object sender, object hostObj)
      
      {
         MSPowerPoint._Presentation p = (MSPowerPoint._Presentation)hostObj;
         p.Saved = MSOffice.MsoTriState.msoFalse;
         SendKeys.Send("{ESC}");
      }
      

      【讨论】:

        猜你喜欢
        • 2017-10-19
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-12-16
        • 1970-01-01
        相关资源
        最近更新 更多