4

I found events that fire when the user receives a message, or hits the send button, but nothing that fire when the user creates a blank, new email.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Trindaz
  • 17,029
  • 21
  • 82
  • 111

1 Answers1

5

You should be able to use the NewInspector event. Example:

Public WithEvents myOlInspectors As Outlook.Inspectors

Private Sub Application_Startup()
    Initialize_handler
End Sub

Public Sub Initialize_handler()
    Set myOlInspectors = Application.Inspectors
End Sub

Private Sub myOlInspectors_NewInspector(ByVal Inspector As Outlook.Inspector)
    Dim msg As Outlook.MailItem
    If Inspector.CurrentItem.Class = olMail Then
        Set msg = Inspector.CurrentItem

        If msg.Size = 0 Then
            MsgBox "New message"
        End If
    End If
End Sub
Geoff
  • 8,551
  • 1
  • 43
  • 50
  • This worked perfectly after I enabled macros. The 'high' security setting in Outlook 2003 doesn't even give you the option to run unsigned macros, so switching to 'medium' did the trick. – Trindaz Sep 13 '10 at 08:16