From: Pegasus [MVP] on


"IdleBrain" <indianmostwanted(a)yahoo.com> wrote in message
news:b44fc9b3-cca1-4178-b2ad-96554a9e93f9(a)y36g2000yqm.googlegroups.com...
> Sorry for misunderstanding your question..
> I can manually go and delete the folder without any error messages or
> can run a script with just those two lines of code and have no
> problem.
>

This is what I suspected. Your problem is caused by one of the following:
a) The code that you do not show us opens the folder you wish to delete, or
a file inside this folder.
b) Your current working directory is the folder you wish to delete.

It is impossible to say which one it is unless you post the full VB Script
code and how exactly you invoke it.

From: IdleBrain on
The problem, like you suggested, was that the working directory was
set to the tempFolderLocation.
As soon as I changed the working directory after I am completed with
the code execution in the tempFolderLocation, the deleteFolder method
did not complain any more about 'Access Denied'!

Appreciate your help and hats off for your insight into the problem.