【发布时间】:2010-10-14 17:21:01
【问题描述】:
当 Microsoft Word 关闭时,关闭事件可以取消。 Excel 也是如此。
但 PowerPoint 关闭事件没有取消标志。
是否可以通过其他方式取消活动?
【问题讨论】:
标签: powerpoint
当 Microsoft Word 关闭时,关闭事件可以取消。 Excel 也是如此。
但 PowerPoint 关闭事件没有取消标志。
是否可以通过其他方式取消活动?
【问题讨论】:
标签: powerpoint
在关闭事件中,您可以将文档设置为Saved = False,这将强制 PowerPoint 询问用户是否要使用“是-否-取消”消息框保存文件。
在事件结束前使用SendKeys({ESC}),它将向消息框发送转义,关闭事件将被取消。
【讨论】:
示例:[不适用于 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}");
}
【讨论】: