title: Run a VBA macro in Spotfire using Ironpython
body: <p>So I would try ask over in this thread <a href="https://stackoverflow.com/questions/17411911/ironpython-run-an-excel-macro?newreg=2773da6014854976989c640ab1deaa4b">IronPython - Run an Excel Macro</a> but I don't have enough reputation. </p>
  
  <p>So roughly following the code given in the link I created some code which would save a file to a specific location, then open a workbook that exists there, calling the macro's within it, which would perform a small amount of manipulation on the data which I downloaded to .xls, to make it more presentable. </p>
  
  <p>Now I've isolated the problem to this particular part of the code (below). </p>
  
  <p>Spotfire normally is not that informative but it gives me very little to go on here. It seems to be something .NET related but that's about all I can tell.</p>
  
  <p><b>The Error Message</b></p>
  
  <blockquote>
    <p>Traceback (most recent call last):   File
    "Spotfire.Dxp.Application.ScriptSupport", line unknown, in
    ExecuteForDebugging   File "", line unknown, in 
    StandardError: Exception has been thrown by the target of an
    invocation.</p>
  </blockquote>
  
  <p><b>The Script</b></p>
  
  <pre><code>from Spotfire.Dxp.Data.Export import DataWriterTypeIdentifiers
  from System.IO import File, Directory
  import clr
  clr.AddReference("Microsoft.Office.Interop.Excel")
  import Microsoft.Office.Interop.Excel as Excel 
  
  excel = Excel.ApplicationClass()   
  excel.Visible = True
  excel.DisplayAlerts = False   
  workbook = ex.Workbooks.Open('myfilelocation')
  
  excel.Run('OpenUp')
  excel.Run('ActiveWorkbook')
  excel.Run('DoStuff')
  
  excel.Quit()
  </code></pre>