Run time error 70: Permission denied

Dear Experts:

i have a VB program it will perform create txt file and copy image file function using filesystem object.
however the program will show me the following error message:

 "Run-time error '70'

 Permission denied"

i had checked all the files and folders, they are not read only.
and i logon as admin with full control of the machine.

what could be the cause of this problem and the solution?
Thanks in advance for helping me to solve this problem.
Who is Participating?
Valliappan ANConnect With a Mentor Senior Tech ConsultantCommented:
Check if you have something to do with Scripting Access. Hope your system can control if Windows Scripting is allowed or not. Since, FSO needs Windows Scripting to be in Windows, to run through.

If you'd like to look at:

Which line causes the error ?
wolveringAuthor Commented:
not sure,i run the exe file in NT.  I think it is the WinNT configuration problem.  what setting could cause this error to occur? as i run the program smoothly in win98.
The new generation of project management tools

With’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Try to create this file manually in the destination directory and see it you can do it.

wolveringAuthor Commented:
Yes i can create files or folder manually
Well first we must identify the line code that caused the error.
You can either install vb there, or use error handling in your code to identify it, or try to remove the suspected offending line and see if it removes the error.
wolveringAuthor Commented:
i am sure it is not the problem of program code because i tested the program in different OS.  this problem happen only in that particular machine with NT installed.
so i am quite sure it is the NT setting problem instead of program code.

   Here is the reason why this error come out :

You tried to write to a write-protected disk, to access a locked file, or to use UNLOCK on a file that was not locked.


Remove write-protection from the disk.

Unlock the file before attempting access.

Lock the file before trying to unlock it.

Remove the UNLOCK statement.

Insert error checking to test for disk/file status before attempting WRITE or UNLOCK operations.

Sweetpillow :)
Try using "Name" function from VB. Before you try make sure that you have closed the file.

I hope this will help you
Are you using APIs to access the file?
All Courses

From novice to tech pro — start learning today.