title: Calling Excel macros from PowerShell with arguments
body: <p>Using Powershell it's rather easy to call Excel macro's from a script, for example with a script like <a href="http://blogs.technet.com/b/heyscriptingguy/archive/2009/01/13/how-do-i-run-an-office-excel-macro-on-multiple-workbooks.aspx?Redirected=true" rel="noreferrer">this</a>:</p>
  
  <pre><code>$excel = new-object -comobject excel.application
  $excelFiles = Get-ChildItem -Path C:\fso -Include *.xls, *.xlsm -Recurse
  Foreach($file in $excelFiles)
  {
     $workbook = $excel.workbooks.open($file.fullname)
     $worksheet = $workbook.worksheets.item(1)
     $excel.Run("CreateChart")
     $workbook.save()
     $workbook.close()
  }
  $excel.quit()
  </code></pre>
  
  <p>However, I didn't manage to call a macro with some arguments. Is this possible or is the best way to write a config file that the macro will read when called?</p>