title: how to close a running instance of Word document? (C#)
body: <p>I could see a lot of very similar threads all around, but nothing seem to give me a solution which ought to be very basic.</p>
  
  <p>From my winforms application, I need to close a running instance of a word document (opened from the application itself). When I open the word document from the application, I keep a track of it in a list. Now how can I close the same doc? </p>
  
  <p>Here is what I tried:</p>
  
  <pre><code>private bool CloseWord(string osPath) //here I pass the fully qualified path of the file
  {
      try
      {
          Word.Application app = (Word.Application)Marshal.GetActiveObject("Word.Application");
          if (app == null)
              return true;
  
          foreach (Word.Document d in app.Documents)
          {
              if (d.FullName.ToLower() == osPath.ToLower())
              {
                 d.What? //How to close here?
                 return true;
              }
          }
          return true;
      }
      catch
      {
          return true;
      }
  }
  </code></pre>
  
  <p>I get a lot of methods for the document object, but only a <code>.Close()</code> to close which has arguments like this: <code>ref object SaveChanges, ref object OriginalFormat, ref object RouteDocument</code> which I dont understand.</p>
  
  <p>What is the ideal way? Thanks..</p>
  
  <p>Edit: </p>
  
  <ol>
  <li><p>I can not close the entire Word application (WinWord) as users might have other word files opened.</p></li>
  <li><p>I need to just terminate the word instance (something like <code>Process.Kill()</code>) without any prompt for user to save or not etc.</p></li>
  </ol>