Skip to main content

Conas baisc gach fillteán folamh in Outlook a scriosadh?

Cuir i gcás go bhfuil an iliomad fillteán folamh faoi fhillteán ríomhphoist in Outlook, go ginearálta is féidir linn na fillteáin folmha a scriosadh ceann ar cheann trí roghchlár cliceáil ar dheis. I gcomparáid le cliceáil ar dheis arís agus arís eile, tabharfaidh an t-alt seo VBA isteach chun gach fofhillteán folamh de fhillteán Outlook amháin a scriosadh ar an mórchóir.

Baisc scrios gach fillteán folamh in Outlook le VBA

Cluaisín Oifige - Cumasaigh Eagarthóireacht agus Brabhsáil Tábáilte i Microsoft Office, Ag Cur le hObair
Kutools le haghaidh Outlook - Treisiú Outlook le 100+ Gnéithe Casta le haghaidh Éifeachtúlacht Superior
Treisigh do Outlook 2021 - 2010 nó Outlook 365 leis na hardghnéithe seo. Bain sult as triail chuimsitheach 60-lá saor in aisce agus ardaigh do thaithí ríomhphoist!

mboilgeog cheart gorm saigheadBaisc scrios gach fillteán folamh in Outlook le VBA

Chun gach fofhillteán folamh de fhillteán Outlook áirithe a bhaint, déan mar a leanas:

1. Brúigh Eile + F11 eochracha chun an fhuinneog Microsoft Visual Basic for Applications a oscailt.

2. Cliceáil Ionsáigh > Modúil, agus greamaigh faoi bhun chód VBA isteach i bhfuinneog an mhodúil nua.

VBA: Scrios gach fofhillteán folamh de fhillteán Outlook áirithe ar an mórchóir

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. Brúigh F5 Eochair nó Rith cnaipe chun an cód VBA seo a rith.

4. Sa bhosca dialóige Roghnaigh Fillteán, roghnaigh an fillteán ar leith a scriosfaidh tú a chuid fofhillteáin folamh ar an mórchóir, agus cliceáil ar an OK cnaipe. Féach an pictiúr:

5. Anois tagann bosca dialóige Kutools for Outlook amach agus taispeánann sé duit cé mhéad fofhillteán folamh a scriosadh. Cliceáil ar an OK cnaipe chun é a dhúnadh.

Go dtí seo, scriosadh gach fofhillteán den fhillteán Outlook sonraithe ar an mórchóir cheana féin.


mboilgeog cheart gorm saigheadAirteagail gaolmhara

Faigh fillteán (cosán fillteáin iomlán) de réir ainm an fhillteáin in Outlook


Uirlisí Táirgiúlachta Oifige is Fearr

Kutools le haghaidh Outlook - Níos mó ná 100 Gnéithe cumhachtacha chun do Outlook a shárú

🤖 Cúntóir Ríomhphoist AI: Ríomhphoist pro toirt le draíocht AI - aon-cliceáil chun freagraí genius, ton foirfe, máistreacht ilteangach. Trasfhoirmigh ríomhphost gan stró! ...

📧 Uathoibriú Ríomhphoist: As Oifig (Ar fáil do POP agus IMAP)  /  Sceideal Seol Ríomhphoist  /  Auto CC/BCC de réir Rialacha Agus Ríomhphost á Sheoladh  /  Auto Ar Aghaidh (Ardrialacha)   /  Beannacht Auto Cuir leis   /  Scoilt Ríomhphoist Ilfhaighteoirí go huathoibríoch i dTeachtaireachtaí Aonair ...

📨 Bainistíocht Ríomhphost: Ríomhphoist a Athghairm go héasca  /  Bloc Ríomhphoist Scam ag Ábhair agus Daoine Eile  /  Scrios Ríomhphoist Dúblacha  /  Cuardach Casta  /  Comhdhlúthaigh Fillteáin ...

📁 Ceangaltáin ProSábháil Baisc  /  Baisc Dícheangail  /  Comhbhrú Baisc  /  Auto Sábháil   /  Auto Dícheangail  /  Comhbhrúite Auto ...

🌟 Draíocht Chomhéadain: 😊Níos mó Emojis Pretty and Cool   /  Treisiú Do Tháirgiúlacht Outlook le Radhairc Tabbed  /  Íoslaghdaigh Outlook In ionad Deiridh ...

???? Wonders aon-cliceáil: Freagair Gach Duine le Ceangaltáin Isteach  /   Ríomhphoist Frith-Iascaireachta  /  🕘 Taispeáin Crios Ama an tSeoltóra ...

👩🏼‍🤝‍👩🏻 Teagmhálaithe & Féilire: Baisc Cuir Teagmhálacha Ó Ríomhphoist Roghnaithe  /  Roinn Grúpa Teagmhála ar Ghrúpaí Aonair  /  Bain Meabhrúcháin Breithlá ...

Thar Gnéithe 100 Fan le do Thaiscéalaíocht! Cliceáil Anseo le Tuilleadh Amach.

 

 

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