ユーザーが新しい空白のメッセージを作成したときにOutlook2003マクロを発射します

StackOverflow https://stackoverflow.com/questions/3674832

質問

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

役に立ちましたか?

解決

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
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top