title: VBS Script to Open Excel and Run Multiple Macros
body: <p>I am attempting to run the following script in my windows task manager.  My goal is to have the VBScript open the excel file and run two macros at a scheduled time every weekday and then save and close once both macros are performed.  I have tested the VBScript below with limited success; the file opens and the first macro runs but for some reason, the second macro is NOT running (and anything after the second macro isn't running either).  Any suggestions?</p>
  
  <pre><code>    Dim objExcel, xlBook
  
      Set objExcel = CreateObject("Excel.Application")
      Set xlBook = objExcel.Workbooks.Open("Q:\MyExcelFile.xlsm", 0, False)
      ObjExcel.Application.Visible = True
  
      objExcel.Application.Run "Module1.Macro1"
      objExcel.Application.Run "Module1.Macro2"
  
  
      xlBook.Save
      xlBook.Close True
      set xlBook = Nothing
  </code></pre>