View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Testing if Directory has read/write access

Try something like the following:

Dim Attr As Long
Attr = GetAttr("\\DellLapTop\MainDrive\Temp")
If Attr And vbReadOnly Then
Debug.Print "Folder is read-only"
Else
Debug.Print "Folder is read-write"
End If

You can also do it with the Scripting.FileSystemObject

Dim FSO As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
If FSO.GetFolder("\\DellLapTop\MainDrive\Temp").Attri butes And 1 Then
Debug.Print "Folder is read only"
Else
Debug.Print "Folder is read-write"
End If



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"Nigel RS" wrote in message
...
What is the best method of testing if a directory has read and write
access?

I have an application that saves files to a network server, I want to test
that the user on opening the application (from a local drive) has read or
read/write access to the remote server directory.

Thanks