Delete read only Files on Computer, shared Network

If you are ever stuck in Excel VBA with the error 70 – Permission Denied, you might be experiencing the same problem I had. The file you are trying to delete or overwrite may be on a network location (mapped drive) or even on local PC folder. All you have to do is to first set the attribute of the file to normal and then kill it. This is how to delete read only files on computer or on a shared network:

MyFilePath = thisworkbook.path & “\FiletobeDeleted.txt”

SetAttr MyFilePath , vbNormal

Kill MyFilePath

It worked good for me and I found this method after struggling for 2 hours. I had to rewrite on a text file on a mapped server location on intranet. This worked 🙂

Skype Us Now

Modeling Experts

We are engineers from Indian Institute of Technology (IIT) - Delhi and are expert in Excel modeling and provide you customize solutions as per you needs. We are expert in advance Financial modeling, business plan development support, business process automation and automated reporting.