我试过
var wordApp = new Microsoft.Office.Interop.Word.Application();
var doc = wordApp.Documents.Open(FileName);
wordApp.Visible = true;
((Microsoft.Office.Interop.Word.ApplicationEvents4_Event)wordApp.Quit) += new ApplicationEvents4_QuitEventHandler(delegate
{
MessageBox.Show("word closed!");
});
但我得到:
Cannot convert method group 'Quit' to non-delegate type 'Microsoft.Office.Interop.Word.ApplicationEvents4_Event'. Did you intend to invoke the method?
Microsoft.Office.Interop.Word._Application.Quit(ref object, ref object, ref object)'
and non-method 'Microsoft.Office.Interop.Word.ApplicationEvents4_Event.Quit'. Using method group.
由于警告,我做了演员表,但没有解决。而且我不知道如何解决这个错误。提前致谢。