title: Import code modules programmatically to Excel workbook
body: <p>I create a workbook dynamically. I want to import code modules (Module1.bas) and (UserForm1.frm) when creating it.</p>
  
  <p><strong>Is there any way to attach such files by using workbook or worksheet objects?</strong></p>
  
  <pre><code>Microsoft.Office.Interop.Excel.Workbook wkBk;
  Microsoft.Office.Interop.Excel.Worksheet wkSht; 
  app = new Microsoft.Office.Interop.Excel.Application();
  app = new Microsoft.Office.Interop.Excel.Application();
  app.DisplayAlerts = false;
  app.Visible = false;
  wkBk = app.Workbooks.Open(strFile, oMissing); 
  wkSht = (Microsoft.Office.Interop.Excel.Worksheet)wkBk.Sheets.get_Item(2); 
  wkBk.Save(); 
  </code></pre>