VBOffice

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: 39.206  | #98
◀ Previous sample Next sample ▶
Reporter Reporter
VBOffice Reporter is an easy to use tool for data analysis and reporting in Outlook. A single click, for instance, allows you to see the number of hours planned for meetings the next month.

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
  DoEvents
  Set Application.ActiveExplorer.CurrentFolder = F1
End Sub
SAM SAM
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