Consulting

Results 1 to 2 of 2

Thread: Outlook VBA: Listen for new emails and trigger popup Msgbox

  1. #1

    Lightbulb Outlook VBA: Listen for new emails and trigger popup Msgbox

    Hi, I intend to trigger some code immediately upon receipt of a new email in Outlook.

    I am following the code exactly word for word as written in this website:
    https://www.tachytelic.net/2017/10/h...ed-in-outlook/

    This should be the basis for me to edit and run more complex code segments

    But even with this basic code demo, the new email event listener does not work.

    I restarted Outlook a few times and sent the email to my Outlook inbox again and again

    Any idea why this code isn't working? Thanks

  2. #2
    I can't see any obvious reason why it wouldn't work - though if it's a security issue, see
    https://www.gmayor.com/create_and_em...gital_cert.htm
    You could use instead a rule that runs on all incoming messages, with a script
    Sub MailHasArrived(Item As Outlook.MailItem)
        If TypeName(Item) = "MailItem" Then
            'do stuff with Item
            MsgBox Item.Subject
        End If
    lbl_Exit:
        Exit Sub
    End Sub
    If the script option isn't available see https://www.slipstick.com/outlook/ru...-script-rules/
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •