|
1)如何删除outlook中的所有空文件夹
http://club.excelhome.net/viewthread.php?tid=749501&pid=5111387&page=1&extra=page%3D1###
Sub DelDirectory()
Dim currentf As MAPIFolder
Set currentf = Application.ActiveExplorer.CurrentFolder
Call recursionDel(currentf)
End Sub
Public Sub recursionDel(parentf As MAPIFolder)
Dim folderArray() As String
If parentf.Class = olFolder Then
ReDim folderArray(parentf.Folders.count)
For n = 1 To parentf.Folders.count
folderArray(n) = parentf.Folders(n).Name
Next
For n = 1 To UBound(folderArray)
Call fsubf(parentf.Folders(folderArray(n)))
Next
If parentf.Items.count = 0 And parentf.Folders.count = 0 Then
Cancel = MsgBox(parentf.Name & "此文件夹为空" & vbNewLine & _
"是否删除?", _
vbYesNo + vbExclamation, "删除空文件夹")
If Cancel = vbYes Then
parentf.Delete
End If
End If
End If
End Sub |
|