View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Excel VBA - deleting populated folder problem

Hi Paul,

Here is some code

Dim sFile
Dim sPath As String

sPath = "C:\NewDir\myTest"

Do
sFile = Dir(sPath & "\*.*")
If sFile < "" Then
Kill sPath & "\" & sFile
End If
Loop Until sFile = ""
RmDir sPath

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"PaulC " wrote in message
...
I can delete an empty folder with RmDir, but how do I delete a populated
folder and all its sub-folders?

Paul


---
Message posted from http://www.ExcelForum.com/