Note: The other languages of the website are Google-translated. Back to English
Mewngofnodi  \/ 
x
or
x
Cofrestru  \/ 
x

or

Sut i swp dileu pob ffolder gwag yn Outlook?

Tybiwch fod yna ddwsinau o ffolderau gwag o dan ffolder post yn Outlook, yn gyffredinol gallwn ddileu'r ffolderau gwag fesul un trwy ddewislen clicio ar y dde. O'i gymharu â chlicio i'r dde dro ar ôl tro, bydd yr erthygl hon yn cyflwyno VBA i ddileu pob is-ffolder gwag o un ffolder Outlook yn gyflym mewn swmp.

Swp dileu pob ffolder gwag yn Outlook gyda VBA

Tab Swyddfa - Galluogi Golygu a Phori Tabbed yn y Swyddfa, a Gwneud Gwaith yn Haws Orau ...
Kutools for Outlook - Yn Dod â 100 o Nodweddion Uwch Pwerus i Microsoft Outlook
  • Auto CC / BCC yn ôl rheolau wrth anfon e-bost; Auto Ymlaen E-byst Lluosog yn ôl rheolau; Ymateb Auto heb weinydd cyfnewid, a nodweddion mwy awtomatig ...
  • Rhybudd BCC - dangos neges pan geisiwch ateb popeth os yw'ch cyfeiriad post yn rhestr BCC; Atgoffwch Wrth Ymlyniadau ar Goll, a mwy o nodweddion atgoffa ...
  • Ymateb (Pawb) Gyda'r Holl Atodiadau yn y sgwrs bost; Ateb Llawer o E-byst ar unwaith; Auto Ychwanegu Cyfarchiad wrth ateb; Auto Ychwanegu Dyddiad ac Amser yn destun ...
  • Offer Ymlyniad: Auto Detach, Cywasgu Pawb, Ail-enwi Pawb, Auto Save All ... Adroddiad Cyflym, Cyfrif Postiau Dethol, Tynnwch y Post a Chysylltiadau Dyblyg ...
  • Bydd mwy na 100 o nodweddion datblygedig datrys y rhan fwyaf o'ch problemau yn Outlook 2010-2019 a 365. Nodweddion llawn treial am ddim 60 diwrnod.

swigen dde glas saethSwp dileu pob ffolder gwag yn Outlook gyda VBA

I gael gwared ar holl is-ffolderi gwag ffolder Outlook penodol, gwnewch fel a ganlyn:

1. Gwasgwch Alt + F11 allweddi i agor ffenestr Microsoft Visual Basic for Applications.

2. Cliciwch Mewnosod > Modiwlau, a'i gludo o dan god VBA i mewn i ffenestr y modiwl newydd.

VBA: Dileu pob is-ffolder gwag o ffolder Outlook penodol mewn swmp

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. Gwasgwch F5 Allweddol neu Run botwm i redeg y cod VBA hwn.

4. Yn y blwch deialog Dewis Ffolder, dewiswch y ffolder benodol y byddwch chi'n ei dileu mewn swmp, a chliciwch ar yr is-ffolderi gwag. OK botwm. Gweler y screenshot:

5. Nawr mae blwch deialog Kutools for Outlook yn dod allan ac yn dangos i chi faint o is-ffolderi gwag sydd wedi'u dileu. Cliciwch y OK botwm i'w gau.

Hyd yn hyn, mae holl is-ffolderi’r ffolder Outlook penodedig wedi’u dileu mewn swmp yn barod.


swigen dde glas saethErthyglau Perthnasol

Dewch o hyd i ffolder (llwybr ffolder llawn) yn ôl enw'r ffolder yn Outlook


Kutools for Outlook - Yn Dod â 100 o Nodweddion Uwch i'w Rhagweld, a Gwneud Gwaith yn Haws Osgach!

  • Auto CC / BCC yn ôl rheolau wrth anfon e-bost; Auto Ymlaen E-byst Lluosog yn ôl arfer; Ymateb Auto heb weinydd cyfnewid, a nodweddion mwy awtomatig ...
  • Rhybudd BCC - dangoswch neges pan geisiwch ateb popeth os yw'ch cyfeiriad post yn rhestr BCC; Atgoffwch Wrth Ymlyniadau ar Goll, a mwy o nodweddion atgoffa ...
  • Ymateb (Pawb) Gyda'r Holl Atodiadau yn y sgwrs bost; Ateb Llawer o E-byst mewn eiliadau; Auto Ychwanegu Cyfarchiad wrth ateb; Ychwanegu Dyddiad i'r pwnc ...
  • Offer Ymlyniad: Rheoli Pob Atodiad ym mhob Post, Datgysylltiad Auto, Cywasgu Pawb, Ail-enwi Pawb, Arbed Pawb ... Adroddiad Cyflym, Cyfrif Postiau Dethol...
  • E-byst Sothach Pwerus yn ôl arfer; Tynnwch y Post a Chysylltiadau Dyblyg... Yn eich galluogi i wneud yn ddoethach, yn gyflymach ac yn well yn Outlook.
tab kutools rhagweld kutools tab 1180x121
kutools rhagweld rhagolygon kutools ynghyd â thab 1180x121
 
Say something here...
symbols left.
You are guest
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    Haig · 1 years ago
    This worked great for me. Thank you. Some folders cannot be deleted as they are native to Outlook, but the sub-folders work great.
  • To post as a guest, your comment is unpublished.
    Martin · 2 years ago
    74 empty folders were deleted but unfortunately also 109 folders that were not. Other empty folders were left untouched.
  • To post as a guest, your comment is unpublished.
    Adam · 3 years ago
    Super easy and incredibly helpful. Thank you!!
  • To post as a guest, your comment is unpublished.
    Spooz · 3 years ago
    I am getting the same error like Bryan.... and now?
    • To post as a guest, your comment is unpublished.
      Carina · 2 years ago
      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
  • To post as a guest, your comment is unpublished.
    Bryan · 3 years ago
    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.
    • To post as a guest, your comment is unpublished.
      mike.ficek@gmail.com · 3 years ago
      Agree - I get the same error.
      • To post as a guest, your comment is unpublished.
        Carina · 2 years ago
        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
        • To post as a guest, your comment is unpublished.
          Munier Saliba · 2 years ago
          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
  • To post as a guest, your comment is unpublished.
    Miroslav · 3 years ago
    Brilliant!!!