Expand the Subfolder When a New Message Arrives

Do you sometimes miss a new email because it's automatically moved to a closed subfolder? This macro expands the subfolder so you can see at a glance whether is has new items.

Last modified: 2013/05/23 | Accessed: 21.058  | #98
◀ Previous sample Next sample ▶
Category-Manager Category-Manager
With Category-Manager you can group your Outlook categories, share them with other users, filter a folder by category, automatically categorize new emails, and more. You can use the Addin even for IMAP.

You can move new emails by a rule to subfolders. However, if the folder currently isn't visible in the folder list because it's collapsed, then you cannot see if it has new unread items.

This script makes the folder visible in the folder list. Copy the script to the module "ThisOutlookSession" and add the action "run a script" to the rule.

tip  How to add macros to Outlook
Public Sub ExpandFolder(Mail As Outlook.MailItem)
  Dim F1 As Outlook.MAPIFolder
  Dim F2 As Outlook.MAPIFolder

  Set F1 = Application.ActiveExplorer.CurrentFolder
  Set F2 = Mail.Parent
  Set Application.ActiveExplorer.CurrentFolder = F2
  Set Application.ActiveExplorer.CurrentFolder = F1
End Sub
Determine the "identity" of your emails. Set with SAM the sender and the folder folder for sent items with the help of rules.
email  Send a message