title: Open Excel file as Read-Only, Discard changes opon closing or Save as
body: <p>I have an excel template/report that I don't want users to modify</p>
  
  <p>I saved the template as <code>Read-Only Recommended</code>  (save as -. tools -> general options) so users are prompted to open as read-only, and are forced to save another copy if modified.</p>
  
  <p>However, I was hoping to remove the prompt, so file open easily accessed without having to click another button</p>
  
  <p>How effectively can I do this?</p>
  
  <p>I tested adding the following to <code>ThisWorkbook</code> module so code is invoked upon opening </p>
  
  <pre><code>Private Sub OpenWorkBookReadOnly()
      ThisWorkbook.ChangeFileAccess Mode:=xlReadOnly
  End Sub 
  </code></pre>
  
  <p>While it works i.e file changes to <code>Read-only</code> upon opening, however it means users will never be able to easily save the documents as long as the VBA codes lives in the workbook</p>
  
  <p>What I want to achieve is this:</p>
  
  <ol>
  <li>Template file opens as read-only (hopefully without having to click a button)</li>
  <li>Users are prompted to <code>save as</code> when there are changes to template</li>
  <li>When users saves a copy, templates read-only (and other) properties doesn't affects this copy.</li>
  </ol>