ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   delete folder (https://www.excelbanter.com/excel-programming/399588-delete-folder.html)

chad

delete folder
 
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

Mike H

delete folder
 
The folder must be empty first

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

Mike

"Chad" wrote:

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


chad

delete folder
 
Perfect, thanks!!


"Mike H" wrote:

The folder must be empty first

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

Mike

"Chad" wrote:

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


Ron de Bruin

delete folder
 
See also
http://www.rondebruin.nl/folder.htm#Delete

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Chad" wrote in message ...
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


Chip Pearson

delete folder
 
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.




"Chad" wrote in message
...
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




All times are GMT +1. The time now is 01:30 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com