Posted on 2002-04-23
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
MyName = Dir
Make_List = Right(maplist, Len(maplist) - 1)
Private Function check_access(pad As String) As Boolean
On Error GoTo handler
Open pad & "TESTFILE" For Output As #1
Kill pad & "TESTFILE"
check_access = True
check_access = False