4

ユーザーがメッセージを受信したとき、または送信ボタンを押したときに発生するイベントを見つけましたが、ユーザーが空白の新しい電子メールを作成したときに発生するイベントはありません。

4

1 に答える 1

5

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
于 2010-09-09T20:59:38.193 に答える