Freedon Posted May 26, 2017 Report Share Posted May 26, 2017 hello, I have a lot of subfolders in my outlook. So when I want to find some special emails I need to open all subfolders to check. So I have to expand them one by one manually. But it's easy to colse them all, just click to collapse the root of the pst file. So I hope I can quickly expand all subfolders by only clicking a button or something else just like I close them. How to set it in outlook? Quote Link to post Share on other sites
flashh4 Posted May 27, 2017 Report Share Posted May 27, 2017 Howdy Freedon, not sure what you are wanting to do with the folders, could you be more specific please ! Thanks Chuck Quote Link to post Share on other sites
oliver Posted June 1, 2017 Report Share Posted June 1, 2017 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 Quote Link to post Share on other sites
Freedon Posted June 3, 2017 Author Report Share Posted June 3, 2017 Thanks for all the help and reply. I take some time to run this macro, but luckly it solves my problem! Thanks again. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.