2010-04-01 17 views

回答

7

在關閉事件中,您可以將文檔設置爲Saved = False,這將強制PowerPoint詢問用戶是否要用Yes-No-Cancel消息框保存該文件。

在事件結束之前使用SendKeys({ESC}),它將向消息框發送轉義,並且關閉事件將被取消。

1

例如:[不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}"); 
} 
相關問題