How to Quickly Create a Subfolder with the Same Name under the Top Folder of Each Outlook Section

At times, you may need to batch create subfolder with the same name under the top folder of each Outlook section, such as a new Calendar subfolder under the Calendar and a new Task subfolder under the Task folder, etc. Now, this post will introduce a method to realize it in bulk.

If you want to store the items related to a specific person in separate folders, you will need to create a set of different kinds of folders for this person. For instance, if the person is “Kim”, you need to create the mail subfolders called “Kim” under “Inbox” and “Sent Items”, calendar subfolder under “Calendar”, Task subfolder under “Tasks” and so on. Creating one by one is a bit troublesome. Thus, here we will teach you a quicker way.

Create Subfolder with the Same Name under the Top Folder of Each Outlook Section

  1. In the first place, start Outlook program.
  2. Then, press “Alt + F11” to access VBA editor in Outlook.
  3. Next, in the editor window, copy the following VBA code into a blank module.
Sub BatchCreateSubFolders()
    Dim objOutlookFile As Outlook.Folder
    Dim objFolder As Outlook.Folder
 
    'Process the default Outlook data file
    Set objOutlookFile = Outlook.Application.Session.GetDefaultFolder(olFolderInbox).Parent
 
    For Each objFolder In objOutlookFile.Folders
        'Create different types of subfolders
        Select Case objFolder.DefaultItemType
               Case olMailItem
                    On Error Resume Next
                    'Skip "Deleted Items", "Outbox", "Junk E-mail" and "RSS Feeds"
                    If (objFolder.Name <> "Deleted Items") And (objFolder.Name <> "Drafts") And (objFolder.Name <> "Outbox") And (objFolder.Name <> "Junk E-mail") And (objFolder.Name <> "RSS Feeds") Then
                       objFolder.Folders.Add "Temp", olFolderInbox
                    ElseIf objFolder.Name = "Drafts" Then
                       objFolder.Folders.Add "Temp", olFolderDrafts
                    End If
               Case olAppointmentItem
                    objFolder.Folders.Add "Temp", olFolderCalendar
               Case olContactItem
                    objFolder.Folders.Add "Temp", olFolderContacts
               Case olTaskItem
                    objFolder.Folders.Add "Temp", olFolderTasks
               Case olNoteItem
                    objFolder.Folders.Add "Temp", olFolderNotes
               Case olJournalItem
                    objFolder.Folders.Add "Temp", olFolderJournal
        End Select
    Next
 
    MsgBox "Complete!", vbExclamation + vbOKOnly
End Sub

VBA Code - Create a Subfolder with the Same Name under the Top Folder of Each Outlook Section

  1. After that, directly press “F5” key button.
  2. When you receive the “Complete!” message box, you can check the folder list.
  3. There has been a set of subfolders under the top folder of each Outlook section. All of them are called as “Temp”.Created Subfolders

Come across Annoying Outlook Troubles

Outlook is admittedly error-prone. For instance, if you frequently shut down your Outlook in an improper manner, your Outlook file may become compromised. At that time, you have to attempt Outlook fix either by the inbuilt PST repair tool or an experienced external utility like DataNumen Outlook Repair. The difficulty and chance of successful Outlook recovery depends on how extreme the damage is as well as how powerful the repair tool is. All in all, calm down in face of any issues. Worry will only make situation worse.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including recover Sql Server and outlook repair software products. For more information visit www.datanumen.com

Leave a Reply

Your email address will not be published. Required fields are marked *