当用户创建新的空白消息时,请发射Outlook 2003宏
-
01-10-2019 - |
题
我发现当用户收到消息或键入发送按钮时,我发现了发射的事件,但是当用户创建空白的新电子邮件时,没有发射。
解决方案
您应该能够使用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
不隶属于 StackOverflow