vba - 当用户创建新的空白邮件时触发 Outlook 2003 宏

标签 vba outlook outlook-2003

我发现当用户收到消息或点击发送按钮时会触发事件,但当用户创建空白的新电子邮件时不会触发任何事件。

最佳答案

您应该能够使用 NewInspector 事件。示例:

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

关于vba - 当用户创建新的空白邮件时触发 Outlook 2003 宏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3674832/

相关文章:

excel - 如果发生冲突,将单元格变为红色

mysql - .Cells VBA引用问题

Excel 应用程序未从 Outlook VBA 函数关闭

php - Outlook 接收 PHP HTML 电子邮件作为代码?

html - Outlook 2003 剥离文本装饰 - HTML 电子邮件

c# - 与 Outlook 互操作的 OpenSharedItem 在 Office 2003 中抛出奇怪的异常,与 Office 2008 一起工作

VBA QueryPerformanceCounter 不工作

vba - 在VBA中区分没有值的double和0的double

python - 使用 Python 和 win32com 从 Outlook GAL 获取联系信息

c# - Outlook 拒绝来自 CryptProtectData() 的密码