outlook event newMail (newItem)

后端 未结 1 869
旧巷少年郎
旧巷少年郎 2021-01-24 09:12

I\'m working with outlook 2003

I search a way to get the event when a new mail is created (when the window of new mail is created)

Note: I search every way to ad

相关标签:
1条回答
  • 2021-01-24 10:11

    This sample code should be placed in the ThisOutlookSession module. Restart Outlook and whenever you create a new email you will see the message box.

    Private WithEvents objinspectors As Outlook.Inspectors
    
    Private Sub Application_Startup()
      Set objinspectors = Application.Inspectors
    End Sub
    
    Private Sub objinspectors_NewInspector(ByVal Inspector As Inspector)
      If TypeName(Inspector.CurrentItem) = "MailItem" Then
        MsgBox "newinspector"
      End If
    End Sub
    
    0 讨论(0)
提交回复
热议问题