2010-09-09 29 views

Répondre

4

Vous devriez pouvoir utiliser l'événement NewInspector. Exemple:

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

Cela a fonctionné parfaitement après avoir activé les macros. Le paramètre de sécurité "élevé" dans Outlook 2003 ne vous donne même pas l'option d'exécuter des macros non signées, donc passer à "moyen" a fait l'affaire. – Trindaz