title: open protected excel file with com, but the running excel does not support addins
body: <p>I need to open the encrypted excel file from code, and the end user can also edit or save the opened file. Then I found a way to handle it by using com:</p>
  <p><a href="https://docs.microsoft.com/zh-cn/previous-versions/office/troubleshoot/office-developer/automate-excel-from-c" rel="nofollow noreferrer">https://docs.microsoft.com/zh-cn/previous-versions/office/troubleshoot/office-developer/automate-excel-from-c</a></p>
  <p>However, The opened excel application does not support excel addins.</p>
  <p>for example: the excel setting like</p>
  <p><a href="https://i.stack.imgur.com/3QfZp.png" rel="nofollow noreferrer">excel setting 1</a>
  <a href="https://i.stack.imgur.com/JMgp4.png" rel="nofollow noreferrer">excel setting 2</a></p>
  <p>when open excel.exe normally，it's like:</p>
  <p><a href="https://i.stack.imgur.com/tUCKP.png" rel="nofollow noreferrer">normally open, correct</a></p>
  <p>but when use com to open excel.exe by the code, it's like:</p>
  <p><a href="https://i.stack.imgur.com/JQkX1.png" rel="nofollow noreferrer">open from code, incorrect</a></p>
  <p>the addins disappear.</p>
  <p>Also, if you reconfig addins option, addins appear again. So I think there may have no initialization when excel.exe was started.</p>
  <p><strong>Is there any way to start open encrypted excel file by excel.exe from code, and all excel function are fine?</strong></p>
  <p>Here is the code with vbs(the link below is c code):</p>
  <pre><code>Set oExcel = CreateObject(&quot;Excel.Application&quot;)
  Set oWorkbook = oExcel.Workbooks.Open(&quot;C:\Users\melon\Desktop\excel\excel tests\chat&amp;sample exam.xlsm&quot;, 0, 0, 5, &quot;76350e01-a0bd-44c6-9e4d-0df382c2d789&quot;)
  oExcel.Visible = true
  </code></pre>