Mail Notification for different folders

Ease of Use


Version tested with

2000, 2002, 2003 

Submitted by:



Brings up a messagebox if a mail arrives in any given folder (not just the default inbox), even if this mail was just moved there. 


This can be helpful if you have more than 1 postbox you need to monitor. Or if you use a folder where many people can move mails into (instead of sending them) and you want to be notified of a new one. 


instructions for use


Option Explicit Private Fold1 As Outlook.MAPIFolder Private WithEvents colItems1 As Outlook.Items Private Sub Application_Startup() 'Insert the folder names here! Set Fold1 = Application.GetNamespace("MAPI").Folders("My Postbox").Folders("Inbox") Set colItems1 = Fold1.Items End Sub Private Sub colItems1_ItemAdd(ByVal Item As Object) MsgBox "New mail from " & item.sendername & " in " & Fold1.Parent.Name End Sub Private Sub Application_Quit() 'Clean Up Set Fold1 = Nothing Set colItems1 = Nothing End Sub

How to use:

  1. Open the VBA-Editor (Alt + F11)
  2. Open the Project Explorer (Ctrl + R)
  3. There search for Projekt1 - Microsoft Outlook Object - ThisOutlookSession
  4. Insert the code there
  5. Modify the line Set Fold1 = to match the folder you want to monitor, you'll need the whole path as shown in the Outlook folderlist, so just "Inbox" might not be enough, you'll have to use the whole path. If you need to go deeper, just add another .Folders("foldername")
  6. Save this and restart Outlook so the Startup-Method get's fired

Test the code:

  1. As I don't know your foldernames an example does not make much sense, sorry!
  2. So just proceed as described above.
  3. Don't forget to change the folder names to match your settings.
  4. Send or simply move a mail to the folder you just specified.
  5. Now you should get a messagebox telling you about the new mail.

Sample File:

No Attachment 

Approved by Zack Barresse

This entry has been viewed 261 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express