title: Check Folder Permissions Before Save VBA
body: <p>I Have created a user form that will open an excel file open &amp; hide the excel. When closing the user form will save &amp; close the excel file. However, there are two types of users of the excel file.</p>
  
  <ol>
  <li>Editors - Those who are entering data into the file</li>
  <li>Viewers - Those who are viewing a file.</li>
  </ol>
  
  <p>The folder which has the excel file only allow "Editors" to save. (Others have no permission to write). Therefore, I have to avoid save part if the user has no wright permission to the folder. Any ideas? My code for the close event of user form is here.</p>
  
  <pre><code>Private Sub UserForm_QueryClose (Cancel As Integer, CloseMode As Integer)
  
  If CloseMode = vbFormControlMenu Then
  
  If ws.AutoFilterMode Then ws.AutoFilterMode = False
  ws.Columns("F:H").Copy
  ws.Activate
  ws.Range("F1").Select
  Application.DisplayAlerts = False
  Selection.PasteSpecial Paste:=xlPasteValues
  Application.DisplayAlerts = True
  Application.CutCopyMode = False
  Application.Visible = True
  ActiveWorkbook.CheckCompatibility = False
  ThisWorkbook.Close savechanges:=True
  ActiveWorkbook.CheckCompatibility = True
  End If
  End Sub
  </code></pre>
  
  <p>Ws Denoted the declared name for the worksheet.</p>
  
  <p>Edit</p>
  
  <p>I have tried &amp; found an alternative method to overcome the situation. However, this is not the solution &amp; is a dirty method to get the result. Please see below code.</p>
  
  <pre><code>Private Sub UserForm_QueryClose (Cancel As Integer, CloseMode As Integer)
  On Error Resume Next
  If CloseMode = vbFormControlMenu Then
  If ws.AutoFilterMode Then ws.AutoFilterMode = False
  ws.Columns("F:H").Copy
  ws.Activate
  ws.Range("F1").Select
  Application.DisplayAlerts = False
  Selection.PasteSpecial Paste:=xlPasteValues
  Application.DisplayAlerts = True
  Application.CutCopyMode = False
  Application.Visible = True
  ActiveWorkbook.CheckCompatibility = False
  ThisWorkbook.Save
  ThisWorkbook.Close savechanges:=False
  ActiveWorkbook.CheckCompatibility = True
  End If
  
  End Sub
  </code></pre>
  
  <p>On above code I have tracked error generated during the save process of viewers &amp; jump to next line by using
  <code>on error resume next</code>.</p>