views:

15

answers:

1

Hi,

All I've found so far are events that get fired when the user receives a message, or hits the send button, but nothing that gets fired when the user first creates a blank, new email before setting the TO field and writing the message etc.

Is there any way to do that?

Cheers, Dave --Trindaz on Fedang #outlook-2003-macros

+1  A: 

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
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