Guys,
While using a treeview control to manipulate file & folder structures, I am getting a runtime error 70 (Permission denied) when trying to delete a folder. The error only occurs under specific conditions. The application also opens & closes Word documents to change some text within them.
Scenario 1 (Folder 1 will be deleted)
Using the treeview on the userform, I add the following structure:
Folder 1\Folder 2\Folder 3\Test.docx
I then delete Folder 1 using FSO.DeleteFolder method, which works - all folders are deleted.
Scenario 2 (Folder 1 will not be deleted)
I add the same structure:
Folder 1\Folder 2\Folder 3\Test.docx
This time I open & close Test.docx to manipulate some text. I then try to delete Folder 1 as before, but this time it fails and I get runtime error 70.
To pinpoint the error in scenario 2, I tried deleting the file and then the folders individually. I can delete Test.docx and Folder 3, but not Folder 2 - Folder 2 seems to be the problem. This seems to happen no matter how many folders are present (i.e., the problem folder is the one above the folder which contains the edited document). E.g. extending scenario 2, Folder 4 would be the problem:
Folder 1\Folder 2\Folder 3\Folder 4\Folder 5\Test.docx
I get the same problem when trying to delete the folder manually, after Test.docx has been opened & closed. When doing it manually I get "Folder Access Denied - you will need to provide administrator permission." The folders were originally stored on the network drive so I moved them locally to see if it changed anything - it didn't.
Any comments or suggestions would be appreciated.
Thanks,
Joe