Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default Checking for File/Directory Permissions

Chip Pearson kindly provided the following code to check read/write access
attributes for files, which works great. How do I check for file and
directory permissions in an NTFS network file system?

In my company network I need to check if the user has full control or at
least modify permission to read/write and delete files and/or directories.
Before my VBA programs try to take specific actions.


' code from C Pearson Jan 2007
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

--
Cheers
Nigel




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Checking for File/Directory Permissions

Nigel,
Short of just creating/modifying/deleting a temp file on the test path and
trapping for permission denied errors, there's the API route.

Maybe these will help:
http://vbnet.mvps.org/code/network/netfileenum.htm
http://vbnet.mvps.org/code/network/netsharecheck.htm

NickHK

"Nigel" wrote in message
...
Chip Pearson kindly provided the following code to check read/write access
attributes for files, which works great. How do I check for file and
directory permissions in an NTFS network file system?

In my company network I need to check if the user has full control or at
least modify permission to read/write and delete files and/or directories.
Before my VBA programs try to take specific actions.


' code from C Pearson Jan 2007
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

--
Cheers
Nigel






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about how to set file and permissions Rudaba Excel Discussion (Misc queries) 1 May 16th 08 11:23 PM
file save error: the file or directory cannot be created dublg Excel Discussion (Misc queries) 1 September 25th 06 07:07 PM
Excel should let me sort the file directory when saving a file Beanee70 Excel Discussion (Misc queries) 0 March 14th 06 07:03 AM
Moving a file without carrying over permissions StuThomson Excel Discussion (Misc queries) 1 December 29th 04 03:27 PM
Directory checking Eric[_6_] Excel Programming 0 July 11th 03 03:53 PM


All times are GMT +1. The time now is 09:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"