I'm getting Permission Denied error when trying kill existing file. What causes this, how can I delete an existing file that's on my hard drive? Thanks.
Code:
If Dir(mFileName) <> "" Then
Kill mFileName ' Kill the existing file
End If
Although you are doing this from VBA, this is not really a VBA issue and there are many possible causes.
First thing to ask is can you delete the file manually?
Enjoy,
Tony
------------------------------------------------------------------------------------ We want to help you; help us to do it by reading this:Before you ask a question.
get the attributes in VBA so that you can decide if it is write protected or system etc. Spreadsheets that are open won't die.
There must be a way of detecting sharing but the only time I need that is over a VPN and it opens the spreadsheet then only the window title will give a clue eg read only in the text - maybe that is what I have to detect but it happens rarely so I haven't bothered yet.
there is a tide in the affairs of man that you Canute ignore.................
If that doesn't work, one of my coworkers had the same issue on her computer and asked for help. In the end, we discovered a Trojan horse had dug its way in her program files. Not saying that is what happened here, but it might be a possibility. Sorry if this didn't help.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.