PC Review


Reply
Thread Tools Rate Thread

Check access right to folder

 
 
Charles
Guest
Posts: n/a
 
      8th May 2008
Hi

Actually an easy one but I can't find anything on google. How can I
check the access right to a folder (I just want to know if the user of
the macro has access to a shared folder)? Is there any function that
does that? (that would be on a network drive)

thanks in advance
Charles
 
Reply With Quote
 
 
 
 
JLGWhiz
Guest
Posts: n/a
 
      8th May 2008
The manual check is to open the workbook, then Tools>SharedWorkbook and check
the list of users in Who has it open window.

"Charles" wrote:

> Hi
>
> Actually an easy one but I can't find anything on google. How can I
> check the access right to a folder (I just want to know if the user of
> the macro has access to a shared folder)? Is there any function that
> does that? (that would be on a network drive)
>
> thanks in advance
> Charles
>

 
Reply With Quote
 
Charles
Guest
Posts: n/a
 
      8th May 2008
Sorry, I meant a windows shared drive folder. Is there any way to do
something like hasaccesstofolder("C:\Folderx\") which would tell me if
the user running the macro has access to the folder

Charles
 
Reply With Quote
 
JLGWhiz
Guest
Posts: n/a
 
      8th May 2008
I have never used it, but check the UserStatus Property in VBA help. It
looks close to what you are describing.

"Charles" wrote:

> Sorry, I meant a windows shared drive folder. Is there any way to do
> something like hasaccesstofolder("C:\Folderx\") which would tell me if
> the user running the macro has access to the folder
>
> Charles
>

 
Reply With Quote
 
Bob Bridges
Guest
Posts: n/a
 
      9th May 2008
I've never had occasion to use them, but there are objects designed for
network administrators; seems to me one of those would tell you what you
needed to know.

Of course, this would be a lot more useful if I could actually point to a
URL documenting one of them, and my screen is kinda full up; I'm not sure
where to look. But if you email me later, I'm sure I can find at least the
general area I saw it in before. Something around MS' scripting
documentation.

--- "Charles" wrote:
> Actually an easy one but I can't find anything on google. How can I
> check the access right to a folder (I just want to know if the user of
> the macro has access to a shared folder)? Is there any function that
> does that? (that would be on a network drive)

 
Reply With Quote
 
Tim Williams
Guest
Posts: n/a
 
      9th May 2008
Have you tried

Dir("\\somedrive\somefolder")

?

Tim

"Charles" <(E-Mail Removed)> wrote in message
news:88977a66-b5d3-40c0-9196-(E-Mail Removed)...
> Hi
>
> Actually an easy one but I can't find anything on google. How can I
> check the access right to a folder (I just want to know if the user of
> the macro has access to a shared folder)? Is there any function that
> does that? (that would be on a network drive)
>
> thanks in advance
> Charles



 
Reply With Quote
 
urkec
Guest
Posts: n/a
 
      9th May 2008
"Bob Bridges" wrote:

> I've never had occasion to use them, but there are objects designed for
> network administrators; seems to me one of those would tell you what you
> needed to know.
>
> Of course, this would be a lot more useful if I could actually point to a
> URL documenting one of them, and my screen is kinda full up; I'm not sure
> where to look. But if you email me later, I'm sure I can find at least the
> general area I saw it in before. Something around MS' scripting
> documentation.
>
> --- "Charles" wrote:
> > Actually an easy one but I can't find anything on google. How can I
> > check the access right to a folder (I just want to know if the user of
> > the macro has access to a shared folder)? Is there any function that
> > does that? (that would be on a network drive)



There is a sample here:


http://www.microsoft.com/technet/scr.../sedcvb02.mspx


--
urkec
 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      9th May 2008
Depending on what you're testing, why not just create a text file and try
saving/deleting/renaming... the file. If it fails on one of them, then they
don't have that kind of access.



Charles wrote:
>
> Hi
>
> Actually an easy one but I can't find anything on google. How can I
> check the access right to a folder (I just want to know if the user of
> the macro has access to a shared folder)? Is there any function that
> does that? (that would be on a network drive)
>
> thanks in advance
> Charles


--

Dave Peterson
 
Reply With Quote
 
Charles
Guest
Posts: n/a
 
      9th May 2008
Hi Dave

That's what I was thinking to initially. But I am a bit concerned
about having a dozen of users doing it all the time and the potential
pollution if the macro fails and files keep accumulating.

Ideally it would be a function that does something like reading the
directory (or anything else) and return an error I can identify like
either "not found" (if the network drive has another letter assigned
for this user) or "access denied" if the user does not have the proper
access rights. I guess I can use the Dir function as Tim suggested and
use "on Error" statement to return if the user has access or not. But
I don't know if there is a better function that would return an error
code corresping to the inability to access the file instead of failing
and creating an error in VBA.

Charles

On 9 May, 12:54, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> Depending on what you're testing, why not just create a text file and try
> saving/deleting/renaming... the file. *If it fails on one of them, then they
> don't have that kind of access.
>
> Charles wrote:
>
> > Hi

>
> > Actually an easy one but I can't find anything on google. How can I
> > check the access right to a folder (I just want to know if the user of
> > the macro has access to a shared folder)? Is there any function that
> > does that? (that would be on a network drive)

>
> > thanks in advance
> > Charles

>
> --
>
> Dave Peterson


 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      9th May 2008
What rights do you want the user to have?

Being able to open the file doesn't mean that they could update/save the file.



Charles wrote:
>
> Hi Dave
>
> That's what I was thinking to initially. But I am a bit concerned
> about having a dozen of users doing it all the time and the potential
> pollution if the macro fails and files keep accumulating.
>
> Ideally it would be a function that does something like reading the
> directory (or anything else) and return an error I can identify like
> either "not found" (if the network drive has another letter assigned
> for this user) or "access denied" if the user does not have the proper
> access rights. I guess I can use the Dir function as Tim suggested and
> use "on Error" statement to return if the user has access or not. But
> I don't know if there is a better function that would return an error
> code corresping to the inability to access the file instead of failing
> and creating an error in VBA.
>
> Charles
>
> On 9 May, 12:54, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> > Depending on what you're testing, why not just create a text file and try
> > saving/deleting/renaming... the file. If it fails on one of them, then they
> > don't have that kind of access.
> >
> > Charles wrote:
> >
> > > Hi

> >
> > > Actually an easy one but I can't find anything on google. How can I
> > > check the access right to a folder (I just want to know if the user of
> > > the macro has access to a shared folder)? Is there any function that
> > > does that? (that would be on a network drive)

> >
> > > thanks in advance
> > > Charles

> >
> > --
> >
> > Dave Peterson


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to check for the existence of the Temporary folder namedTemporary Folder a , 2 and so on before deleting as the name is not fixed Yuvraj Microsoft Excel Programming 1 3rd May 2009 09:41 PM
How to check for the existence of the Temporary folder namedTemporary Folder 1,2 and so on As Yuvraj Microsoft Excel Programming 0 3rd May 2009 04:55 PM
Check for "Write Access" on a file/folder in .NET =?Utf-8?B?R2FuZXNoIE11dGh1dmVsdQ==?= Microsoft Dot NET 1 3rd Jan 2007 12:36 AM
Check if folder exists, if yes just copy sheet in to folder? Simon Lloyd Microsoft Excel Programming 3 19th Jun 2006 03:44 PM
Check Permissions to access a file/folder =?Utf-8?B?a3JhbW1haQ==?= Microsoft ASP .NET 2 7th Apr 2006 04:52 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:41 PM.