ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   RmDir (https://www.excelbanter.com/excel-programming/426535-rmdir.html)

Charlotte E

RmDir
 
I'm trying to remove/delete a directory, that I use for storing some
temporary files, using:

RmDir DestinationPath


Problem is that it doesn't work, if the folder contains files?!?

What's the point of that?!? Only reason to delete a directory at folder
level is excately to avoid deleting a great number of files, one by one!

Anyway, how do I delete a directory from VBA, which contains files?


TIA,




Mike H

RmDir
 
Charlotte,

All the methods can be found here

http://www.rondebruin.nl/folder.htm#Delete

Mike

"Charlotte E" wrote:

I'm trying to remove/delete a directory, that I use for storing some
temporary files, using:

RmDir DestinationPath


Problem is that it doesn't work, if the folder contains files?!?

What's the point of that?!? Only reason to delete a directory at folder
level is excately to avoid deleting a great number of files, one by one!

Anyway, how do I delete a directory from VBA, which contains files?


TIA,





Jacob Skaria

RmDir
 
Use the FSO object..

Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFolder DestinationPath

If this post helps click Yes
---------------
Jacob Skaria


"Mike H" wrote:

Charlotte,

All the methods can be found here

http://www.rondebruin.nl/folder.htm#Delete

Mike

"Charlotte E" wrote:

I'm trying to remove/delete a directory, that I use for storing some
temporary files, using:

RmDir DestinationPath


Problem is that it doesn't work, if the folder contains files?!?

What's the point of that?!? Only reason to delete a directory at folder
level is excately to avoid deleting a great number of files, one by one!

Anyway, how do I delete a directory from VBA, which contains files?


TIA,






All times are GMT +1. The time now is 03:50 AM.

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