问题基本解决了,谁来接分呢?
首先,创建一个函数:
private void OnClose(Word.Document doc, ref bool chancel)
{
//关闭后的处理代码
if(doc.name=="a;dfs;fsf")
chancel=true;
}
然后进行委托:
myApp.DocumentBeforeClose+= new Word.ApplicationEvents2_DocumentBeforeCloseEventHandler(OnClose);