title: Writing and Executing VBA Macros on Excel without using Excel.Interop
body: <p><strong>Scope:</strong></p>
  
  <p>I am generating automated reports using excel, but since we have restrictions on our server, we can't install <code>Excel.Interop</code> or use any <code>COM</code> object to perform such action.</p>
  
  <p>We have been using <a href="http://epplus.codeplex.com/" rel="nofollow">EPPLUS</a> as our main helper on this task but it has some serious restrictions when it comes to more intricated things such as <code>PivotCharts</code> and <code>Macros</code>.</p>
  
  <p>We have just finished the project, missing only the <code>PivotCharts</code> since EPPLUS has no support for them.</p>
  
  <p><strong>Question:</strong></p>
  
  <p>How can we :</p>
  
  <p><strong>A)</strong> Write Macros to a <code>.xlsm</code> file? (We could write one named "Auto_Open" so that excel would run it uppon opening, creating the charts and stuff)</p>
  
  <p><strong>OR</strong></p>
  
  <p><strong>B)</strong> Run a macro within our code to generate those charts after putting all the needed data there?</p>
  
  <p>Not using <code>Excel.Interop</code> is a must at this moment. We are open for some suggestions such as 
  <a href="http://www.spreadsheetgear.com/" rel="nofollow">SpreadsheetGear</a> and <a href="http://www.easyxls.com/" rel="nofollow">EasyXLS</a>, but we can't find any sample or piece of code that actually shows how to Write or Run macros.</p>
  
  <p>Thanks in advance</p>