Closing word from a web browser
Posted on 2005-05-03
I opened a word document from a web browser control on my windows form (c# windows application) and have access to the document object. I tried to close word without saving the document but I kept getting this error message below
**An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in mycomponent.dll
**Additional information: This method or property is not available because this document is in another application.
Here is my code in a command button.
object saveChanges = Word.WdSaveOptions.wdDoNotSaveChanges;
object originalFormat = Type.Missing;
object routeDocument = Type.Missing;
_doc.Close( ref saveChanges, ref originalFormat, ref routeDocument);
How can I handle this? I do not want to see the prompt which tries to save my document whenever I move to another document. I use a combo box to select different documents(templates)