title: Using VB script to run VBA Macros and save the excel workbook
body: <p>I am trying to run a macro from a * <em>.vbs</em> file. You can find the code below. The module runs with no issue (this has been tested). But workbook is not saved. I tried adding <code>ThisWorkbook.Save</code> into the module itself but it causes an error and tells me that my file is <em>ReadOnly</em>. To clarify, I want to know how to save the workbook after running a macro through VBScript.</p>
  
  <pre><code>Option Explicit
  
  'On Error Resume Next 'Comment-out for debugging
  
  ExcelMacro
  
  Sub ExcelMacro() 
  
   Dim xlApp 
   Dim xlBook 
  
   Set xlApp = CreateObject("Excel.Application") 
   Set xlBook = xlApp.Workbooks.Open("\\internal.company.com\River_Automated.xlsm", 0, True) 
   xlApp.Run "Update"
  
   xlBook.Save
   xlBook.Close
   xlApp.Quit 
  
   Set xlBook = Nothing 
   Set xlApp = Nothing 
  
  End Sub 
  </code></pre>
  
  <p><em>Some side notes that may be helpful:</em></p>
  
  <p>After running VBScript I got this message that:</p>
  
  <blockquote>
    <p>Resume.xlsw already exists. Do you want to replace it?</p>
  </blockquote>
  
  <p>I added lines that create a text file right before <code>End Sub</code> and it creates it. So, it runs the macro but does not save the workbook.</p>