title: Open an Excel file, run a macro, save it (overwrite)
body: <p>I'm currently trying to create a .vbs which </p>
  
  <ol>
  <li>opens Excel</li>
  <li>runs macro</li>
  <li>saves it with new information</li>
  <li>quits</li>
  </ol>
  
  <p>This is what I have so far:</p>
  
  <pre><code>Dim xlApp, xlBook
  
  Set xlApp = CreateObject("Excel.Application")
  xlApp.DisplayAlerts = False
  
  Set xlBook = xlApp.Workbooks.Open("C:\test\test.xlsm", 0, True) 
  
  xlApp.Run "test"
  xlbook.Save
  xlBook.Close False
  set xlBook = Nothing
  
  xlApp.Quit
  Set xlApp = Nothing
  
  WScript.Echo "Upload is Finished"
  WScript.Quit
  </code></pre>
  
  <p>I get the 'Upload is finished', but the macro is not saved. What am I doing wrong?</p>
  
  <p>The macro is simply putting something from one worksheet to another:</p>
  
  <pre><code>Sub test()
  '
  ' test Macro
  '
      Sheets("Sheet2").Select
      Range("A1:A10").Select
      Range("A10").Activate
      Selection.Cut
      ActiveSheet.Previous.Select
      Selection.End(xlToLeft).Select
      Range("A2").Select
      ActiveSheet.Paste
  End Sub
  </code></pre>