+ Reply to Thread
Results 1 to 8 of 8

Macro to send birthday reminder via outlook email

  1. #1
    Forum Contributor
    Join Date
    01-05-2011
    Location
    India
    MS-Off Ver
    Excel 2013
    Posts
    243

    Macro to send birthday reminder via outlook email

    Hi,

    Please help to create a macro to send birthday reminder via outlook email if the date and month equals system date and month. Macro to execute every time the workbook is opened and look for the date and send reminder email to [email protected] mailid.

    Hi Vijay,

    Your birthday is 24-Oct-79.

    ___________________________
    Please help!

    Vijay
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Macro to send birthday reminder via outlook email

    Please Login or Register  to view this content.
    take the ' away from send to make it automatically send.

    you may want to add like a msgbox or something to prompt if email was/is going to be sent
    Attached Files Attached Files
    Last edited by humdingaling; 10-24-2013 at 01:38 AM.
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Forum Contributor
    Join Date
    01-05-2011
    Location
    India
    MS-Off Ver
    Excel 2013
    Posts
    243

    Re: Macro to send birthday reminder via outlook email

    Thank you. This is sending email only to the last occurance. It is send email only for Anand birthdate is today. However the email is not displayed for Vijay

  4. #4
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Macro to send birthday reminder via outlook email

    the display part happens once because it overwrites previously display
    however this does not mean it does not send
    take the ' away from send to make it automatically send.

    if you wish to preview it
    put a break on .display

  5. #5
    Forum Contributor
    Join Date
    01-05-2011
    Location
    India
    MS-Off Ver
    Excel 2013
    Posts
    243

    Re: Macro to send birthday reminder via outlook email

    I change the code to .send and changed the date to today's. I received one email for Name Vijay, I am not receiving email for Anand with today's date.

  6. #6
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Macro to send birthday reminder via outlook email

    sorry put the set outside the loop
    try this

    Please Login or Register  to view this content.


    also put on error statement

  7. #7
    Registered User
    Join Date
    12-04-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Macro to send birthday reminder via outlook email

    This works for me...

    Sub workbook_open()

    Dim myRange As Range
    Dim firstDate As Date
    Dim datechk As Date

    datechk = DateValue(Now)

    If (Sheet2.Cells(1, 2)) < DateValue(Now) Then 'to avoid running macro more than once a day

    todaysdate = DateValue(Now) 'GET TODAYS DATE
    futuredate = DateValue(Now) + 20
    Set myRange = Worksheets("sheet1").Range("C5:C40")'number of the members in the bthday list
    For Each c In myRange 'SET RANGE HERE I.E. COLUMN TO COMPAIR TO

    If c.Value >= todaysdate And c.Value <= futuredate Then
    Dim name As String
    Dim msg As String
    name = Right(c.Address, 2) 'it will work only upto 100 rows in C column
    Dim verb As String
    verb = "'s birhtday is on "
    msg = (Worksheets("sheet1").Cells(name, "B") & verb & c.Value)
    Sheet2.Cells(1, 2) = datechk
    bthdayreminder (msg)
    End If
    Next c
    End If

    End Sub



    Sub bthdayreminder(msg)
    'Working in 2000-2010

    Dim OutApp As Object
    Dim OutMail As Object
    Dim Fname As String
    Dim emailRng As Range, cl As Range
    Dim sTo As String

    Set emailRng = Worksheets("sheet3").Range("A2:A4") 'for multiple recipients

    For Each cl In emailRng
    sTo = sTo & ";" & cl.Value
    Next

    sTo = Mid(sTo, 2)
    'Turn on Outlook for Excel
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

    Dim myRange As Range
    Dim firstDate As Date

    With OutMail
    .to = sTo
    .CC = ""
    .BCC = ""
    .Subject = "Birthday Reminder"
    'replace x with <
    s = s & "<p><font face=""Monotype Corsiva"" size=""4"" "
    s = "Hi Team, <br> "
    s = s & "<br><b>" & msg & "</b><br>"
    s = s & "<br> Thanks & Regards, <br> " & "xxx"

    .HTMLBody = s
    .Send 'or use
    'Display
    End With

    Set OutMail = Nothing
    Set OutApp = Nothing


    End Sub
    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    ThisWorkbook.Save'automatically saving the Workbook
    End Sub

  8. #8
    Registered User
    Join Date
    07-31-2014
    Location
    south Africa
    MS-Off Ver
    2010
    Posts
    1

    Re: Macro to send birthday reminder via outlook email

    HI

    I Have a small problem I need an macro to allow me to send yearly induction reminders to my workers via emailYearly Induction 2014.xls but must be limited number at a time e.g 20. I have a small start.

    Thank you

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Automatic Email or Reminder When Birthday is Approaching
    By jebindavidson in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-08-2016, 08:59 AM
  2. Email Macro o send Outlook Email
    By asivaprakash in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-01-2013, 07:05 PM
  3. Macro to send email without outlook
    By puuts in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-27-2013, 04:14 PM
  4. Macro to send outlook email from a different mailbox
    By naveenrv in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-25-2013, 05:11 PM
  5. Macro to send email in outlook
    By uncleslinky in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-10-2012, 10:36 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1