title: how to copy ExcelWorkSheet from template with new CodeModule
body: <p>I am having an issue with copying a <code>ExcelWorkSheet</code> and the corresponding <code>CodeModule</code> of the copied sheet. Let me explain:</p>
  
  <p><strong>Scenario:</strong>
  I have an excel file with macro's (.xlsm) and I use this excel file as a template to create an other excel file (data will be copied into the new file).</p>
  
  <p>So, first I fetch some data from a database and open the excel template (<code>.xlsm</code>) file.</p>
  
  <p>At a certain point, some entries need to be in different worksheets, this is where the 'WorkSheets.Add()' comes in.</p>
  
  <pre><code> var newSheet = workbook.Worksheets.Add("someName", templateSheet);
  </code></pre>
  
  <p>After copying the template sheet (which contains 'VBA' code that I want to duplicate as well), I am experiencing problems.</p>
  
  <p>It seems that the 'CodeModule' of the newly created sheet equals the one from the template by name AND by reference. </p>
  
  <p>That is; all the property values are the same and: <code>workbook.VbaProject.Modules</code> contains only the initial code modules of the template file and not a new one for the new <code>newSheet</code>.</p>
  
  <p>Even worse, if I want to bind a new <code>CodeModule</code> like this:</p>
  
  <pre><code>workbook.VbaProject.Modules.AddModule("test");
  newSheet.CodeModule.Name = "test";
  </code></pre>
  
  <p>both the <code>newSheet.CodeModule</code> and <code>templateSheet.CodeModule</code> are set to <code>null</code> (well <code>Nothing</code> actually, since I am using VB.Net).</p>
  
  <p>So the question: is this a bug or am I doing something wrong here? And even better: can you guide the way to accomplish this scenario?</p>