Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ambiguity between methods [duplicate]

Possible Duplicate:
How to eliminate warning about ambiguity?

I'm working with MS Office Word in my application,using the following code:

var wordApplication = new Microsoft.Office.Interop.Word.Application();
var wordDoc = wordApplication.Documents.Open(ref fileName);

//do it.. 

the call of:

wordDoc.Close();
wordApplication.Quit();

give an:

Ambiguity between 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.

I tried to set requests arguments:

object nullObject = Type.Missing;
wordDoc.Close(ref nullObject, ref nullObject, ref nullObject);
wordApplication.Quit(ref nullObject, ref nullObject, ref nullObject);

but it gives same error. How to fix this? Thanks in advance!

like image 673
Jack Avatar asked Jan 06 '12 14:01

Jack


1 Answers

Have you tried this?

((_Application)wordApplication).Quit(ref nullObject,
                                     ref nullObject,
                                     ref nullObject);
like image 163
Arnold Zokas Avatar answered Oct 17 '22 16:10

Arnold Zokas