title: Opening Word Document through code in Visual Studio C#
body: <p>I am developing a Office Development with Visual Studio. And receive the error below </p>
  
  <pre><code>Error: 
  **
  Unable to cast COM object of type 'Microsoft.Office.Interop.Word.ApplicationClass' to interface type 'Microsoft.Office.Interop.Word._Application'. 
  This operation failed because the QueryInterface call on the COM component for the interface with IID '{00020970-0000-0000-C000-000000000046}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
  **
  </code></pre>
  
  <p>Code: (also at <a href="https://gist.github.com/1056809" rel="nofollow">https://gist.github.com/1056809</a> )</p>
  
  <pre><code>if (File.Exists((string)strDocPath))
  {
      Word.Application wdApp = new Word.Application();
      wdApp.Visible = true; //Error thrown here
  
      object readOnly = false;
      object isVisible = true;
      object oMissing = System.Reflection.Missing.Value;
  
      //Open the word document
      //Error thrown on line below.
      Word.Document aDoc = wdApp.Documents.Open(ref strDocPath, ref oMissing, ref readOnly, ref oMissing, ref oMissing, ref oMissing,
                                                ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref isVisible,
                                                ref oMissing, ref oMissing, ref oMissing, ref oMissing); 
  
  
      // Activate the document
      aDoc.Activate();
  }
  </code></pre>
  
  <p>What is this error?  How may I avoid it?</p>