Retro : Show popup for new mail in Outlook 2000

This is the sort of thing you shouldn’t need to know right..?  ’cause you don’t use Oulook 2000 any more right..?


My new job still does and as I now can’t be bothered to write something (or buy something) to give me the outlook 2003-style ‘new message’ tray popup I found the following macro for other unfortunates in large companies (companies that take forever to upgrade software) who use this version.  Application_NewMail is an event handler BTW…


Private Sub Application_NewMail()


Dim objNSMapi As NameSpace
Dim objMapiFold As MAPIFolder
Dim objNewMail As MailItem


Set objNSMapi = GetNamespace(“MAPI”)
Set objMapiFold = objNSMapi.GetDefaultFolder(olFolderInbox)
Set objNewMail = objMapiFold.Items.GetFirst


On Error GoTo CleanExit


ShowMessage:


If MsgBox(“You have new mail from ” & objNewMail.SenderName & ” [” & objNewMail.Subject & “]” & String(2, vbCrLf) & “Would you like to read it now”, vbQuestion + vbYesNo, “New Mail Notification”) = vbYes Then
    objNewMail.Display
Else
    objNewMail.Close olDiscard
End If


CleanExit:


MsgBox Err.Description


Set objNSMapi = Nothing
Set objMapiFold = Nothing
Set objNewMail = Nothing


End Sub