How to Auto Move Items in a Folder to Its Parent Folder before Deleting It in Outlook

By default, in Outlook, when you delete a folder, its items will also be moved to the “Deleted Items” folder. If you wish Outlook to auto move the items in a folder to its parent folder before deleting it, you can use the means shared in this article.

When you delete a folder, Outlook will warn you that all of its contents will be moved to the “Deleted Items” folder as well. But, most of time, you simply want to delete this folder, not including the items stored in it. Therefore, you hope that the items can be automatically moved to the folder’s parent folder. Here we will teach you how to realize it via VBA. If you don’t know anything about VBA, you can first read my previous article – “How to Run VBA Code in Your Outlook“.Auto Move Items in a Folder to Its Parent Folder before Deleting It in Outlook

Auto Move Items in a Folder to Its Parent Folder before Deleting It

  1. To begin with, access Outlook VBA editor via “Alt + F11”.
  2. Then, in the new window, open the “ThisOutlookSession” project.
  3. Subsequently, copy and paste the following VBA code into this project.
'Display the macro in the context menu
Sub Application_FolderContextMenuDisplay(ByVal CommandBar As Office.CommandBar, ByVal Folder As Outlook.Folder)
    Dim objCommandBarButton As Office.CommandBarButton
    Set objCommandBarButton = CommandBar.Controls.Add(msoControlButton)
    With objCommandBarButton
         .Style = msoButtonIconAndCaption
         .Caption = "[Smart] Delete Folder"
         .FaceId = 1668
         .OnAction = "Project1.ThisOutlookSession.DeleteFolder_MoveItemsToParentFolder"
    End With
End Sub

Sub DeleteFolder_MoveItemsToParentFolder()
    Dim objCurrentFolder As Outlook.Folder
    Dim objParentFolder As Outlook.Folder

    Set objCurrentFolder = Outlook.ActiveExplorer.CurrentFolder
    Set objParentFolder = objCurrentFolder.Parent
    Dim i As Long
    'Move items to parent folder
    For i = objCurrentFolder.Items.Count To 1 Step -1
        objCurrentFolder.Items.Item(i).Move objParentFolder
    'Delete the current folder
End Sub

Copy Code into ThisOutlookSession Project

  1. After that, you can have a shot now.
  2. At first, right click the subfolder you want to delete.
  3. Then, from the context menu, choose “[Smart] Delete Folder” option.Smart Delete a Folder
  4. At once, Outlook will delete the folder and move its items to its parent folder.
  5. In my instance, I delete “To Bob” subfolder. Its parent folder is “Sent Items”. Therefore, all of its items have been moved to “Sent Items”, like the following screenshot.Items Auto Moved to Parent Folder

Keep in Mind that Outlook Is Vulnerable

You should bear in mind an unquestioned fact – Outlook is susceptible to errors or corruption. Thus, you have to beware of all the potential threats around your Outlook data file, including virus, improper exiting and so on. Besides, you’d better prepare a powerful and credible Outlook fix tool, like DataNumen Outlook Repair. It can assist you to fix Outlook issues within minutes

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including mdf fix and outlook repair software products. For more information visit

Comments are closed.