Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Easy Way to Check File Privileges?

I am recursively looping through a folder hierarchy, and then through all the
files in each folder. As part of my process, I need to check my ability to
open each of the files (i.e. do I have the correct permission) for read or
read/write. Is there a quick way to do this in VBA without actually trying
to open each file?

Here is some fragmentary code to illustrate my use of variables (from the
NG, of course):

Dim fso As Scripting.FileSystemObject
Dim oDir As Folder
Dim fSubDir As Folder ' Used for recursion...
Dim oFile As File

....

Set fso = CreateObject("Scripting.FileSystemObject")
Set oDir = fso.getfolder(strPath)

....

For Each oFile In fSubDir.Files
' check to see if I have "Read" or "Read/Write" permission for each
file
' and report those for which I don't
Next oFile

Thanks in advance,

Eric
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
is there an easy way to convert an word xp file to excel xp? Maniacal Zebra Excel Discussion (Misc queries) 1 June 25th 07 08:05 AM
Is there an easy way to open a text file and modify only a part of it? muster Excel Programming 1 May 30th 07 03:18 AM
code to check file size everytime an Excel file is opened Kaiser[_2_] Excel Programming 2 July 30th 06 05:46 PM
easy way to check for forbidden characters? Ouka[_26_] Excel Programming 2 December 21st 05 10:01 PM
Auto Run and Installation privileges zSplash Excel Programming 2 April 9th 04 10:07 PM


All times are GMT +1. The time now is 10:30 AM.

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

About Us

"It's about Microsoft Excel"