delete folder

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm using kill function to delete files. I'm having trouble using this to
delete folders. Can I use this to delete folders or is there a better way?

Thanks,
Chad
 
The folder must be empty first

Sub getrid()
On Error Resume Next
RmDir "C:\Myfolder\"
On Error GoTo 0
End Sub

Mike
 
Note that RmDir requires that the folder be empty and then the deletion of
the folder is total and unrecoverable. I would recommend you use the Recycle
Bin which allows you to delete folders that are not empty and puts them in
the recycle bin so they can be restored, just in case. See
www.cpearson.com/Excel/Recycle.htm for example code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top