Solved

read-only access

Posted on 2002-04-23
2
147 Views
Last Modified: 2010-05-02
Hai,

I'm using the functions below to find some directory in which a user has write access. However, in a map with 50 subdirectories where the user only has write access to 5 of them I find the procedure to slow.

Does someone know a quicker way to check for write access to the sub maps?

(BTW, yes, most of the functions came out of VBA help files  ;-)   )

Function Make_List() As String
Dim MyPath As String, MyName As String, maplist As String
  MyPath = "f:\data\"
  MyName = Dir(MyPath, vbDirectory)
  Do While MyName <> ""
    If MyName <> "." And MyName <> ".." Then
      If (GetAttr(MyPath & MyName) And vbDirectory) = vbDirectory Then
            If check_access(MyPath & MyName & "\") Then maplist = maplist & "," & MyName
      End If
    End If
    MyName = Dir
  Loop
  Make_List = Right(maplist, Len(maplist) - 1)
End Function

Private Function check_access(pad As String) As Boolean
  On Error GoTo handler
  Open pad & "TESTFILE" For Output As #1
  Close #1
  Kill pad & "TESTFILE"
  check_access = True
  Exit Function
handler:
  check_access = False
End Function

Kind regards
0
Comment
Question by:ehout
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Accepted Solution

by:
Elmo_ earned 150 total points
ID: 6962315
ehout,

If you goto the following website you should get everything you need and more.

http://www.allapi.net/apilist/apifunction.php?apifunction=GetFileSecurity

This API should allow you to identify the security type on the folders you are checking.

There is also an example of how to get the Security Type and Change it.

Hope this helps.

0
 
LVL 3

Author Comment

by:ehout
ID: 7069801
Hi,

Indeed it seems to do the trick. However I'm not a hardcore programmer (though willing to learn). Could you or someone please tell me how to use that function?

The ntfs example seems a bit complex to me.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Excel VBA, find a string in a column, update a cell 7 117
Convert VB6 MSXML2.ServerXMLHTTP process to C# 2 81
IF ELSE Statement in Excel Macro VBA 16 99
VB6 Enviroment 3 35
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question