Spara una macro di Outlook 2003, quando l'utente crea un nuovo messaggio vuoto
-
01-10-2019 - |
Domanda
ho scoperto gli eventi che il fuoco quando l'utente riceve un messaggio, o preme il pulsante di invio, ma niente che il fuoco quando l'utente crea un vuoto, nuova e-mail.
Soluzione
Si dovrebbe essere in grado di utilizzare l'evento NewInspector. Esempio:
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
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow