当用户创建新的空白邮件时触发 Outlook 2003 宏 [英] Fire an Outlook 2003 macro when the user creates a new blank message

查看:28
本文介绍了当用户创建新的空白邮件时触发 Outlook 2003 宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I found events that fire when the user receives a message, or hits the send button, but nothing that fire when the user creates a blank, new email.

推荐答案

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

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

这篇关于当用户创建新的空白邮件时触发 Outlook 2003 宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆