title: inserting selected page from one word document in another word document with c#
body: <p>I have a requirement to move selected pages from word DocumentA into another word DocumentB.
  So in the end DocumentB should have its own contents plus selected pages from DocumentA inserted at selected pages in DocumentB. The page number in DocumentB I will set thru properties.</p>
  
  <p>This is the code I am using to just append contents of DocumentA to DocumentB.</p>
  
  <pre><code>  object missing = System.Reflection.Missing.Value;
    Word._Application wordApp = new Word.Application();
    Word._Document aDoc = new Word.Document();
  
    try
    {
  
       wordApp.Visible = false;
       object readOnly = false;
       object isVisible = false;
  
       aDoc = wordApp.Documents.Open(ref fPath1, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing);
  
       Word.Selection selection = wordApp.Selection;
       selection.InsertFile(fPath2, ref missing, ref missing, ref missing, ref missing);
       aDoc.Save();
       wordApp.Quit(ref missing, ref missing, ref missing);
     }
          catch(Exception ex)
          {
              throw new Exception(ex.Message);
          }
          finally
          {
              wordApp = null;
              aDoc = null;
          }
  </code></pre>
  
  <p>However, I keep getting this exception 'object reference not set to instance of object' at the line 'selection.InsertFile...'</p>
  
  <p>What is going wrong here?</p>
  
  <p>And how do I insert contents of page 2 from DocumentA into page 3 of DocumentB?</p>
  
  <p>Thanks for your time.</p>