Forum Discussion
joce1
May 24, 2019Copper Contributor
Automatic emails through excel based on new data
Hi everyone :) I'm attempting to create an excel worksheet that automatically emails an individual with reminders of approaching deadlines. I've created a date calculator- an employee enters in a 's...
Berndvbatanker
May 24, 2019Iron Contributor
Hi.
you can send eMail automatically from Excel. the following example fires an e-Mail if anyone enter cells .A1:A10
Private Sub Worksheet_Change(ByVal Target As Range)
Dim objOut As Object
Dim objOutMail As Object
If Not Intersect(Range("A1:A10"), Target) Is Nothing Then
If Target.Value <> "" Then
Set objOut = CreateObject("Outlook.Application")
Set objOutMail = objOut.createitem(0)
With objOutMail
.Subject = "Change by " & Environ("username")
.body = "chance in cell: " & Target.Address & vbLf & _
"New value: " & Target.Value
.to = "b.held@Held-office.de"
.send
End With
Set objOutMail = Nothing
objOut.Quit
Set objOut = Nothing
End If
End If
End Sub
Regards
Bernd
http://www.vba-tanker.com