title: How can I open a word document by using CreateObject in C#?
body: <p>I tried it by using the following code,but it threw an exception.<code>"Exception has been thrown by the target of an invocation."</code></p>
  
  <pre><code>System.Type wordType = System.Type.GetTypeFromProgID("Word.Application");
          Object word = System.Activator.CreateInstance(wordType);
          wordType.InvokeMember("Visible", BindingFlags.SetProperty, null, word, new Object[] { true });
          Object documents = wordType.InvokeMember("Documents", BindingFlags.GetProperty, null, word, null);
          object nullobj = Missing.Value;
          string fileName=System.AppDomain.CurrentDomain.BaseDirectory + "assets\\sample_doc.docx";
          object[] args = new object[15] { fileName, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj};
          Object document = documents.GetType().InvokeMember("Open", BindingFlags.InvokeMethod, null, documents,args);`
  </code></pre>