none
Emails from Excel RRS feed

  • Question

  • I am trying to have Excel trigger an email to notify me when a specific cell reaches a specific value.

    I have tried the recommended VB code that I can find online but none seems to work.

    Can you send me some additional VB code that might work. 

    Thank you,

    Tuesday, July 17, 2018 5:09 AM

All replies

  • Hello Joeseph Yacure,

    Put below code in your sheet module and then try to change value in A1. It will display a mail while value in A1 larger than 100.

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(ActiveSheet.Range("A1"), Target) Is Nothing Then
        If ActiveSheet.Range("A1").Value > 100 Then
        Set olApp = CreateObject("Outlook.Application")
        Set olMail = olApp.CreateItem(0)
        olMail.To = "Test@Test"
        olMail.Subject = "TestSubject"
        olMail.Display
        'use below code will send the mail directly
        'olMail.Send
        End If
    End If
    End Sub

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, July 17, 2018 8:08 AM