메인 컨텐츠로 가기

Outlook에서 모든 빈 폴더를 일괄 삭제하는 방법은 무엇입니까?

Outlook의 메일 폴더 아래에 빈 폴더가 수십 개 있다고 가정하면 일반적으로 메뉴를 마우스 오른쪽 버튼으로 클릭하여 빈 폴더를 하나씩 삭제할 수 있습니다. 반복적으로 마우스 오른쪽 단추를 클릭하는 것과 비교하여이 문서에서는 한 Outlook 폴더의 모든 빈 하위 폴더를 대량으로 빠르게 삭제하는 VBA를 소개합니다.

VBA를 사용하여 Outlook의 모든 빈 폴더 일괄 삭제

Office 탭 - Microsoft Office에서 탭 편집 및 탐색을 활성화하여 작업을 원활하게 만듭니다.
Outlook용 Kutools - 탁월한 효율성을 위한 100개 이상의 고급 기능으로 Outlook 향상
이러한 고급 기능으로 Outlook 2021~2010 또는 Outlook 365를 향상하세요. 포괄적인 60일 무료 평가판을 즐기고 이메일 경험을 향상시키십시오!

화살표 블루 오른쪽 거품VBA를 사용하여 Outlook의 모든 빈 폴더 일괄 삭제

특정 Outlook 폴더의 빈 하위 폴더를 모두 제거하려면 다음과 같이하십시오.

1. 프레스 다른 + F11 키를 눌러 Microsoft Visual Basic for Applications 창을 엽니 다.

2. 딸깍 하는 소리 끼워 넣다 > 모듈, VBA 코드 아래에 새 모듈 창에 붙여 넣습니다.

VBA : 특정 Outlook 폴더의 모든 빈 하위 폴더를 대량으로 삭제

Public Sub DeletindEmtpyFolder()
Dim xFolders As Folders
Dim xCount As Long
Dim xFlag As Boolean
Set xFolders = Application.GetNamespace("MAPI").PickFolder.Folders
Do
FolderPurge xFolders, xFlag, xCount
Loop Until (Not xFlag)
If xCount > 0 Then
MsgBox "Deleted " & xCount & "(s) empty folders", vbExclamation + vbOKOnly, "Kutools for Outlook"
Else
MsgBox "No empty folders found", vbExclamation + vbOKOnly, "Kutools for Outlook"
End If
End Sub

Public Sub FolderPurge(xFolders, xFlag, xCount)
Dim I As Long
Dim xFldr As Folder 'Declare sub folder objects
xFlag = False
If xFolders.Count > 0 Then
For I = xFolders.Count To 1 Step -1
Set xFldr = xFolders.Item(I)
If xFldr.Items.Count < 1 Then 'If the folder is empty check for subfolders
If xFldr.Folders.Count < 1 Then 'If the folder contains not sub folders confirm deletion
xFldr.Delete 'Delete the folder
xFlag = True
xCount = xCount + 1
Else 'Folder contains sub folders so confirm deletion
FolderPurge xFldr.Folders, xFlag, xCount
End If
Else 'Folder contains items or (subfolders that may be empty).
FolderPurge xFldr.Folders, xFlag, xCount
End If
Next
End If
End Sub

3. 프레스 F5 키 또는 달리기 버튼을 눌러이 VBA 코드를 실행합니다.

4. 폴더 선택 대화 상자가 나타나면 빈 하위 폴더를 대량으로 삭제할 특정 폴더를 선택하고 OK 단추. 스크린 샷보기 :

5. 이제 Outlook 용 Kutools 대화 상자가 나타나고 얼마나 많은 빈 하위 폴더가 삭제되었는지 보여줍니다. 클릭 OK 버튼을 눌러 닫습니다.

지금까지는 지정된 Outlook 폴더의 모든 하위 폴더가 이미 대량으로 삭제되었습니다.


화살표 블루 오른쪽 거품관련 기사

Outlook에서 폴더 이름으로 폴더 (전체 폴더 경로) 찾기


최고의 사무 생산성 도구

Outlook 용 Kutools - 귀하의 전망을 강화하는 100개 이상의 강력한 기능

🤖 AI 메일 도우미: AI 마법이 적용된 즉각적인 전문가 이메일 - 원클릭으로 천재적인 답변, 완벽한 어조, 다국어 숙달이 가능합니다. 손쉽게 이메일을 변환하세요! ...

📧 이메일 자동화: 부재중(POP 및 IMAP에서 사용 가능)  /  이메일 보내기 예약  /  이메일 발송 시 규칙에 따른 자동 참조/숨은참조  /  자동 전달(고급 규칙)   /  인사말 자동 추가   /  여러 수신자 이메일을 개별 메시지로 자동 분할 ...

📨 이메일 관리: 이메일을 쉽게 기억할 수 있습니다.  /  제목 및 기타 사기 이메일 차단  /  중복 이메일 삭제  /  고급 검색  /  폴더 통합 ...

📁 첨부 파일 프로일괄 저장  /  일괄 분리  /  일괄 압축  /  자동 저장   /  자동 분리  /  자동 압축 ...

🌟 인터페이스 매직: 😊더 예쁘고 멋진 이모티콘   /  탭 보기로 Outlook 생산성 향상  /  문을 닫는 대신 전망을 최소화하세요 ...

???? 원클릭 불가사의: 수신 첨부 파일과 함께 전체 회신  /   피싱 방지 이메일  /  🕘발신자의 시간대 표시 ...

👩🏼‍🤝‍👩🏻 연락처 및 캘린더: 선택한 이메일에서 연락처 일괄 추가  /  연락처 그룹을 개별 그룹으로 분할  /  생일 알림 제거 ...

이상 100 특징 당신의 탐험을 기다려주세요! 더 알아보려면 여기를 클릭하세요.

 

 

Comments (10)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
This worked great for me. Thank you. Some folders cannot be deleted as they are native to Outlook, but the sub-folders work great.
This comment was minimized by the moderator on the site
74 empty folders were deleted but unfortunately also 109 folders that were not. Other empty folders were left untouched.
This comment was minimized by the moderator on the site
Super easy and incredibly helpful. Thank you!!
This comment was minimized by the moderator on the site
I am getting the same error like Bryan.... and now?
This comment was minimized by the moderator on the site
The script tries to delete a folder that was already deleted.
I added a row after xFlag = False with this content:
on error resume next
This comment was minimized by the moderator on the site
I am getting the following error when run the above " Run-time error '-2147352567 (80020009)' Cannot delete this folder. Right-click the folder, and then click properties to check your permissions for the folder. See the folder owner or your administrator to change your permissions"

It appears the script moves 1 item to the deleted folder and then errors out.
This comment was minimized by the moderator on the site
Agree - I get the same error.
This comment was minimized by the moderator on the site
The script tries to delete a folder that was already deleted.
I added a row after xFlag = False with this content:
on error resume next
This comment was minimized by the moderator on the site
Indeed, add:

On Error Resume Next

AFTER:

Dim x Fldr As Folder 'Declare sub folder objects
xFlag = False

It should look like this:

Dim x Fldr As Folder 'Declare sub folder objects
xFlag = False
On Error Resume Next
This comment was minimized by the moderator on the site
Brilliant!!!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations