oliver

Members
  • Content Count

    1
  • Joined

  • Last visited

Posts posted by oliver

  1. hello,

    You can do that via VBA. I find a article online which may be just what you want. Below is the codes:

    Sub ExpandAllMailFolders()
        Dim objCurrentFolder As Outlook.Folder
        Dim objPSTFolders As Outlook.Folders
        Dim objFolder As Outlook.Folder
    
        Set objCurrentFolder = Application.ActiveExplorer.CurrentFolder
        'Specify a specific pst file
        'Change "PSTName" to the name of your own Outlook PST file
        Set objPSTFolders = Application.Session.Folders("PSTName").Folders
     
        For Each objFolder In objPSTFolders
            Call ProcessFolder(objFolder)
        Next
    
        DoEvents
        Set Application.ActiveExplorer.CurrentFolder = objCurrentFolder
    End Sub
    
    Sub ProcessFolder(ByVal objCurFolder As Outlook.Folder)
        Dim objSubfolder As Outlook.Folder
     
        'Only expand the mail folders
        If objCurFolder.DefaultItemType = olMailItem Then
           Set Application.ActiveExplorer.CurrentFolder = objCurFolder
           DoEvents
     
           'Process all subfolders recursively
           If objCurFolder.Folders.Count > 0 Then
              For Each objSubfolder In objCurFolder.Folders
                  Call ProcessFolder(objSubfolder)
              Next
           End If
        End If
    End Sub

    you can create a  button for this macro. so you can click the button to expand all subfolders. And here is the link of the article

     

    https://www.datanumen.com/blogs/quickly-expand-collapse-mail-folders-outlook/

     

    Hope it helps