title: Python: Using win32com.client.dispatch to open workbook deactivates the workbook add-in
body: <p>I am trying to run an Excel macro from Python.</p>
  
  <p>I've used this piece of code:</p>
  
  <pre><code>import os
  import win32com.client
  
  filepath = r"myfilepath"
  
  if os.path.exists(filepath):
      xl=win32com.client.Dispatch("Excel.Application")
      xl.Workbooks.Open(Filename=filepath)
      xl.Application.Run("SendReport")
  ##    xl.Application.Save() # if you want to save then uncomment this line and change delete the ", ReadOnly=1" part from the open function.
      xl.Application.Quit() # Comment this out if your excel script closes
      del xl
  </code></pre>
  
  <p>The code works fine, but my workbook uses custom VBA functions from an add-in. When I open the workbook with this dispatch method the add-in is deactivated and the functions don't work anymore.</p>
  
  <p>Is there any alternative way to open the workbook that will leave my add-in active?</p>