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!
Have you tried this?
((_Application)wordApplication).Quit(ref nullObject,
ref nullObject,
ref nullObject);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With