I can't call Close
my opened word document:
docs.Close(WdSaveOptions.wdDoNotSaveChanges, nullobject, nullobject);
or Quit
on the application:
wordObject.Quit(WdSaveOptions.wdDoNotSaveChanges);
Without getting this compiler warning:
Warning 1 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.
And full code:
Microsoft.Office.Interop.Word.Application wordObject = new Microsoft.Office.Interop.Word.Application();
object file = pathToFile; //this is the path
object nullobject = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word.Document docs = wordObject.Documents.Open(file, nullobject, nullobject, nullobject,
nullobject, nullobject, nullobject, nullobject, nullobject, nullobject, nullobject, nullobject, nullobject, nullobject, nullobject, nullobject);
Using Office library 15.
Microsoft.Office.Interop.Word.ApplicationEvents4_Event.Quit(WdSaveOptions.wdDoNotSaveChanges);
– vallabha