Send mail if today is the birthday.
Solved/Closed
RWomanizer
Posts
365
Registration date
Monday February 7, 2011
Status
Contributor
Last seen
September 30, 2013
-
Updated on Nov 28, 2018 at 02:01 PM
bkdroid13 Posts 11 Registration date Wednesday May 29, 2019 Status Member Last seen October 5, 2019 - Jun 19, 2019 at 02:18 AM
bkdroid13 Posts 11 Registration date Wednesday May 29, 2019 Status Member Last seen October 5, 2019 - Jun 19, 2019 at 02:18 AM
Related:
- How to send birthday emails automatically using excel vba
- Net send windows 11 - Guide
- Excel online vba - Guide
- How to stop postmaster emails - Guide
- Vba excel mac - Guide
- Transfer data from one excel worksheet to another automatically - Guide
5 responses
RWomanizer
Posts
365
Registration date
Monday February 7, 2011
Status
Contributor
Last seen
September 30, 2013
120
Apr 15, 2011 at 04:15 AM
Apr 15, 2011 at 04:15 AM
Eureka!
I Got the code for this problem
Suppose that person name in column C,
Date of Birth in column D,
and E-Mail id in Column E.
Cheers, :)
Rahul
I Got the code for this problem
Suppose that person name in column C,
Date of Birth in column D,
and E-Mail id in Column E.
Sub bdMail()
Dim OutApp As Object
Dim OutMail As Object
Dim cell As Range
Dim lastRow As Long
Dim dateCell As Date
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
lastRow = Range("A" & Rows.Count).End(xlUp).Row
On Error GoTo cleanup
For Each cell In Range("D2:D" & lastRow)
dateCell = cell.Value
If Day(dateCell) = Day(Date) And Month(dateCell) = Month(Date) Then
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = cell.Offset(0, 1).Value
.Subject = "Happy Birthday"
.Body = "Dear " & Cells(cell.Row, "C").Value _
& vbNewLine & vbNewLine & _
"Many Happy Returns of the Day " _
& vbNewLine & vbNewLine _
& vbNewLine & vbNewLine & _
"Cheers," & vbNewLine & _
"Rahul"
.send
End With
On Error GoTo 0
Set OutMail = Nothing
End If
Next cell
cleanup:
Set OutApp = Nothing
Application.ScreenUpdating = True
End Sub
Cheers, :)
Rahul
Jun 18, 2015 at 03:07 AM
It was very very helpful. Many Thanks!
Could you please e-mail me this code by taking into consideration changing body text color, font and style.
Looking forward to getting your sooner reply!
BR,
Gunay
Feb 5, 2018 at 01:13 PM
Jun 18, 2019 at 02:44 AM
Please elaborate the steps also, how to use this code.
Thanks
Jun 18, 2019 at 07:45 AM
Jun 19, 2019 at 02:18 AM