title: EPPlus Add Worksheet with Latest Version of Office Losses All Macros
body: <p>When you run the following code on a file that has any VBA macro's whatsoever:</p>
  
  <pre><code>using (ExcelPackage xlPackage = new ExcelPackage(new FileInfo("Test.xlsm")))
  {
      xlPackage.Workbook.Worksheets.Add("TestTab");
      xlPackage.Save();
  }
  </code></pre>
  
  <p>You get the following issue(upon opening the edited file):</p>
  
  <blockquote>
    <p>We found a problem with some content in 'Test.xlsm'. Do you want us to
    recover as much as we can? If you trust the source of this workbook,
    click Yes.
    <a href="https://i.stack.imgur.com/81YQQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/81YQQ.png" alt="enter image description here"></a></p>
  </blockquote>
  
  <p>(if you click yes)</p>
  
  <blockquote>
    <p>Removed Part: /xl/vbaProject.bin part.  (Visual Basic for Applications
    (VBA))
    <a href="https://i.stack.imgur.com/HeR3X.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HeR3X.png" alt="enter image description here"></a></p>
  </blockquote>
  
  <p>Then your VBA Marco is gone... I also have received:</p>
  
  <blockquote>
    <p>The Visual Basic for Applications (VBA) macros in the workbook are
    corrupted and have been deleted. The macro corruption most likely
    exists in the current file. To recover the macros, open a backup copy
    of this file if you have one.
    <a href="https://i.stack.imgur.com/jDfWj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jDfWj.png" alt="enter image description here"></a></p>
  </blockquote>
  
  <p>I only see this issue on the latest update(Office 365 Excel 1708 - 8431.2079). When I test on older versions of excel or on versions that have not been upgraded to the latest version I do not experience this issue.</p>
  
  <p>It appears the latest office update has introduced this issue into the opening of files that have been modified(specifically when a new worksheet in inserted) by <a href="https://github.com/JanKallman/EPPlus" rel="nofollow noreferrer">EPPlus</a>(Latest 4.5.0). </p>
  
  <p>Has anybody else experienced this issue? Maybe someone has a work around of some sort. I was hoping not to have to dig into the source code :(</p>
  
  <p><strong>Edit</strong>: Took Mr. Pie's advise and cloned the ticket, maybe someone clever than me has some insight into source: <a href="https://github.com/JanKallman/EPPlus/issues/5" rel="nofollow noreferrer">GitHub</a></p>