Send a mail notification when the value of the cell is completed

unknownymous

Board Regular
Joined
Sep 19, 2017
Messages
249
Office Version
  1. 2016
Platform
  1. Windows
Hi Guys,

So I have below data in excel and I'm just wondering if the macro can send an email notification to me once the user click Completed (drop down type - Completed/Incomplete).


NoUsernameStatus
1SamCompleted/Incomplete
2TinCompleted/Incomplete
3JoshCompleted/Incomplete
4AnaCompleted/Incomplete
5BenCompleted/Incomplete

<tbody>
</tbody>


Email Notification details:

Subject: Task Completed
Body: The task has been completed by the user as of "today's date"

Also, I need to BCC some participants for the email notif.

PS: I'm using microsoft outlook 2010


Any help will be much appreciated.


Thank you!
 
Last edited:

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
in a module ,paste the following code.
NOTE : YOU MUST HAVE THE OUTLOOK REFERENCE CHECKED IN VBE(Alt-F11); menu,tools, references, Microsoft Outlook XX Object library

Rich (BB code):
Public Sub EmailNotice(ByVal pvKey, pvUser)
Dim oApp As Outlook.Application
Dim oMail As Outlook.MailItem
Dim olMailItem

Set oApp = CreateObject("Outlook.Application")
Set oMail = oApp.createitem(olMailItem)

   With oMail
            .to = "fMulder@xfiles.fbi.gov"
            .CC = ""
            .BCC = ""
            .Subject = "Project closed"
            .Body = pvKey & " was completed by " & pvUser
            
              'You can add other files also like this
            '.Attachments.Add ("C:\test.txt")
            
            .Send      'or use     .Display
   End With
End Sub




Now, paste the trigger event:


open the VBE window: Alt-F11,
in the far left PROJECT window pane,
under the VBAProject (your workbook)
dbl-click the ThisWorkbook object,
in the far right pane (code section)
paste this code in there


Rich (BB code):
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim isct As Range
Dim vProj, vUser

Set isct = Application.Intersect(Target, Range("C2:C5000"))
If (Not (isct Is Nothing)) Then
   if target.value = "Completed/Incomplete" then
      vProj = Target.Offset(0, -2).Value
      vUser = Environ("Username")
      EmailNotice vProj, vUser
   endif 

End If
Set isct = Nothing
End Sub
 
Last edited:
Upvote 0
Hello,

So I have below codes but I also want to add my outlook signature. How can I incorporate that?


' Create a new mail message item.
Set NewMail = OlApp.CreateItem(olMailItem)
With NewMail
.Subject = Range("E" & i).Value
.To = Range("B" & i).Value
.CC = Range("C" & i).Value
.BCC = Range("D" & i).Value
.Body = Range("F" & i).Value
If Range("H" & i).Value <> "" Then .Attachments.Add Range("H" & i).Value
If Range("I" & i).Value <> "" Then .Attachments.Add Range("I" & i).Value
If Range("J" & i).Value <> "" Then .Attachments.Add Range("J" & i).Value
If Range("K" & i).Value <> "" Then .Attachments.Add Range("K" & i).Value
If Range("L" & i).Value <> "" Then .Attachments.Add Range("L" & i).Value

End With

NewMail.Send


Any help will be much appreciated. Thanks!
 
Upvote 0

Forum statistics

Threads
1,214,965
Messages
6,122,499
Members
449,089
Latest member
Raviguru

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top