当Microsoft Word关闭时,可以取消关闭事件。Excel也是如此。
但是PowerPoint关闭事件没有取消标志。
是否有其他方法可以取消该事件?
当Microsoft Word关闭时,可以取消关闭事件。Excel也是如此。
但是PowerPoint关闭事件没有取消标志。
是否有其他方法可以取消该事件?
Saved = False
,这将强制 PowerPoint 使用 Yes-No-Cancel 消息框询问用户是否要保存文件。SendKeys({ESC})
,它会向消息框发送 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}");
}