• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1334
  • Last Modified:

delete file permission denied using vb6

I am trying to Delete a text file but keep getting a permission denied error. I can Copy it but cannot Move or Delete it.
0
DblTMO
Asked:
DblTMO
1 Solution
 
odd lieCommented:
This can happen when someone has the file in use, try to chech if the file is in use,
If in use , try to find the owner of the file and close that connection.

regards
Oldelphi
0
 
DblTMOAuthor Commented:
I am the owner. I am Importing the file into Access then St the FSO = Nothing. After that I need to Copy the file to a Backup directory. After the Copy I need to Delete the orginal.
0
 
sha_joshCommented:
You can delete using command prompt if you have any issues with deleting using Explorer.
1. Open command prompt
2. type this below command. I have used c:\windows\test.tmp as example file you want to delete:
del /f /q c:\windows\test.tmp

This should work!
Cheers
0
 
ZhaolaiCommented:
Try this:

    Dim FSO As Object
    Set FSO = CreateObject("Scripting.FileSystemObject")
    FSO.DeleteFile "FileToBeDeleted", True


0
 
DblTMOAuthor Commented:
I would like to thank those who offered solutions.  They would all worked if I had closed the Text Object. I had closed all the FSO but not the TSO. Sometimes it the easy/obvious things that stop you.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now