This piece of code uses RmDir to delete the Mailbox. AFAIK, RmDir cannot delete a folder if it is not empty, so first clear the contents in the folder, then delete the directory.
Private Sub PrepareDirModified(dirStr As String)
On Error Resume Next
If Right(dirStr, 1) <> "\" Then dirStr = dirStr & "\"
Kill dirStr & "*.*"
RmDir dirStr
MkDir dirStr
On Error GoTo 0
End Sub
Hope this helps.
source
share