0
我正在一个Word应用程序加载在C#。Word加载DocumentBeforeClose事件只发射一次
我试图使用DocumentBeforeClose
事件:
Microsoft.Office.Tools.Word.Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
vstoDoc.BeforeClose += new System.ComponentModel.CancelEventHandler(ThisDocument_BeforeClose);
我能应付,但是当我尝试关闭并打开一个文件(不是整个应用程序),我无法处理此事件的任何更多。
编辑:
DocumentBeforeClose很好。
但如何,我可以使用参考BOOL取消
我尝试:
void Application_DocumentBeforeClose(_Word.Document Doc, ref bool Cancel)
{
Cancel = true;
}
但其doestn工作:(