title: Compiled python program using win32com keeps crashing
body: <p>I am using pyinstaller to compile a python file to .exe. When I run the generated .exe the program crashes with this message:</p>
  <blockquote>
  <p>Traceback (most recent call last):
  File &quot;EBOMcompareV3.py&quot;, line 397, in 
  File &quot;win32com\client_<em>init</em>_.py&quot;, line 79, in GetActiveObject
  pywintypes.com_error: (-2147221021, 'Operation unavailable', None, None)
  [15336] Failed to execute script EBOMcompareV3</p>
  </blockquote>
  <p>I am attempting to connect to an open Excel workbook:</p>
  <pre><code>import win32com.client
  
  ExcelApp = win32com.client.GetActiveObject(&quot;Excel.Application&quot;)
  ExcelWrkbook = ExcelApp.ActiveWorkbook
  </code></pre>
  <p>Any advice?</p>
  <p>Edit:
  Here is a small program that I wrote that produces the error</p>
  <pre><code>import os, sys
  import win32com.client
  
  ExcelApp = win32com.client.GetActiveObject (&quot;Excel.Application&quot;)
  ExcelWrkbook = ExcelApp.ActiveWorkbook
  
  ExcelWrksht = ExcelWrkbook.Workseets(1)
  
  ExcelWrkshet.Range(&quot;A1&quot;).value = &quot;test&quot;
  </code></pre>