title: How do you bypass locked for editing message by opening an Excel file ReadOnly?
body: <p>I have a macro to open a file which I would like to run using VBS.</p>
  
  <p>It loads the macro but gets stuck on a "ABC is locked for editing" message.</p>
  
  <p>I would need to bypass <strong>any</strong> additional locked for editing messages with <strong>Read Only</strong>. If I make the application visible, it will show the message and I click on "Read Only" and it will run ok.</p>
  
  <pre><code>Dim xlApp, xlBook, xlFile
  Set xlApp = CreateObject("Excel.Application")
  
  xlApp.Application.Visible = True
  xlApp.AlertBeforeOverwriting = False
  
  Set xlFile = xlApp.Workbooks.Open("\\PATH\CDRsyslog.txt", 0, True)
  Set xlBook = xlApp.Workbooks.Open("D:\SYSCDR.xlsm", 0, True)
  
  xlFile.ReadOnlyRecommended = True
  xlBook.ReadOnlyRecommended = True
  
  xlApp.Run "CDRMACRO.CDRMACRO"
  
  xlBook.Close
  xlFile.Close
  xlApp.Quit
  
  Set xlBook = Nothing
  Set xlApp = Nothing
  
  WScript.Quit 
  </code></pre>
  
  <p>I've tried (changes implemented above)</p>
  
  <pre><code>Set xlFile = xlApp.Workbooks.Open("\\FILEPATHANDNAMEHERE", 0, True)
  </code></pre>
  
  <p>I have also tried to change the macro, but I reverted the changes since the macro runs just fine without changes. </p>
  
  <p>Somewhere I need to tell the VBS to simply open any other files as read-only and thereby bypass further "locked for editing" messages.</p>