title: How to get user permissions of a file with Excel 2003 VBA?
body: <p>I am very new to <a href="/questions/tagged/vba" class="post-tag" title="show questions tagged 'vba'" rel="tag">vba</a> and I was tasked to make a list of the files in a given folder as well as the users with permissions for every file.</p>
  
  <ul>
  <li>I was able to get the filenames in the folder,</li>
  <li>but I don't know how to get the list of users with permissions. </li>
  </ul>
  
  <p>I am using excel 2003. </p>
  
  <p>I found this code which adds 'everyone' to the permissions of a folder:</p>
  
  <blockquote>
    <p>'Adds everyone in the permissions Function SetPermissions()
        Dim strHomeFolder, strHome, strUser
        Dim intRunError, objShell, objFSO</p>
  
  <pre><code>strHomeFolder = "C:\Test"
  
  Set objShell = CreateObject("Wscript.Shell")
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  If objFSO.FolderExists(strHomeFolder) Then
      intRunError = objShell.Run("%COMSPEC% /c Echo Y| cacls " _
      &amp; strHomeFolder &amp; " /e /c /g everyone:F ", 2, True)
  
      If intRunError &lt;&gt; 0 Then
          Wscript.Echo "Error assigning permissions for user " _
          &amp; strUser &amp; " to home folder " &amp; strHomeFolder
      End If
  End If End Function
  </code></pre>
  </blockquote>
  
  <p>However, i don't know how to modify the code to return the current permissions granted by the specified folder. I would also like to do this for a specified file. I would really appreciate any help. Thanks!</p>