+ Reply to Thread
Results 1 to 35 of 35

Need a macro for sending mails wishing brithday

  1. #1
    Forum Contributor
    Join Date
    11-29-2018
    Location
    Chennai
    MS-Off Ver
    MS office 2010
    Posts
    233

    Need a macro for sending mails wishing brithday

    Hi team,

    I would like to write a macro which has to send birthday wishes on employees birthday.

    I have the employee code, name and their birthday date in the spreadsheet.

    Can any one please help me...

    Thanks in advance

  2. #2
    Forum Contributor
    Join Date
    11-29-2018
    Location
    Chennai
    MS-Off Ver
    MS office 2010
    Posts
    233

    Re: Need a macro for sending mails wishing brithday

    Hi.. can anyone please help me out....

  3. #3
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Need a macro for sending mails wishing brithday

    Check this thread. Is about checking dates and sending emails.
    https://www.excelforum.com/excel-pro...s-reached.html
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  4. #4
    Forum Contributor
    Join Date
    11-29-2018
    Location
    Chennai
    MS-Off Ver
    MS office 2010
    Posts
    233

    Re: Need a macro for sending mails wishing brithday

    Hi Kokosek.

    Thanks for this one. But does this macro sends email automatically everyday for the one who has birthday??

    Also if I need to add a standard image with the wishes, how do I add that, please guide me for that as well..

  5. #5
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Need a macro for sending mails wishing brithday

    When you change this line:

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    or similar (depends which code you will choose)
    for:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    will be sending email t automatically for people with birthday set for today.

  6. #6
    Forum Contributor
    Join Date
    11-29-2018
    Location
    Chennai
    MS-Off Ver
    MS office 2010
    Posts
    233

    Re: Need a macro for sending mails wishing brithday

    Hi thank you for the quick response.

    Well do I need to run the Excel every day so it sends mails automatically??

    How do I add a pic in the mails.

  7. #7
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Need a macro for sending mails wishing brithday

    Excel file has to be run manually. If it contains:

    Please Login or Register  to view this content.
    then after opening it will send email automatically.
    Depends which options you choose here (comment or uncomment desired option):
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    it will send emails in background.

  8. #8
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Need a macro for sending mails wishing brithday

    With picture.
    Put into VBA module:

    Please Login or Register  to view this content.
    or check attached file.
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    11-29-2018
    Location
    Chennai
    MS-Off Ver
    MS office 2010
    Posts
    233

    Re: Need a macro for sending mails wishing brithday

    Hi thank u.

    I believe whenever we open this Excel.it automatically sends out the mail.

    If I would require the content font to be edited, do I need to change the context in the macro??

    Also.In my database if I have 3 ppl having birthday in same day, does the macro automatically groups out.

    I want this to be manually controlled instead of automatically sending. Can u put a button asking to send mails??

    Would that be possible??

  10. #10
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Need a macro for sending mails wishing brithday

    Ad.1. Yes
    Ad.2. Yes
    Ad.3. No. each person separately.
    Ad.4. Remove Workbook_Open from VBA (check attached file) and button is already there (did You check attached file?)

  11. #11
    Forum Contributor
    Join Date
    11-29-2018
    Location
    Chennai
    MS-Off Ver
    MS office 2010
    Posts
    233

    Re: Need a macro for sending mails wishing brithday

    I checked the file. I didn't get wat u are mentioning as Ad 1.

    Also where is the workbook_open??

  12. #12
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Need a macro for sending mails wishing brithday

    Weird, Work fine for me.
    Open attached file, press Alt + F11 (it will open VBA editor), you should see something as below:

    Capture.JPG

    if you remove code on right, it won't send automatically after opening and you have to use button

    Captu222re.JPG

  13. #13
    Forum Contributor
    Join Date
    11-29-2018
    Location
    Chennai
    MS-Off Ver
    MS office 2010
    Posts
    233

    Re: Need a macro for sending mails wishing brithday

    Worked now. How do I insert the picture..

    Do I need to save the default pic in a location and give the path in the code??

    Also if I need to give a font color to happy birthday text. Wat should I do??

  14. #14
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Need a macro for sending mails wishing brithday

    As you see in VBA, email body is created in html (check on internet about FONT, SIZE and COLOR)
    You can create message as you want to.
    I can't paste it here because firewall blocked html content.

    EDIT: check attached file, with coloured font and picture inside.
    Find in VBA code parts as below to edit:

    Please Login or Register  to view this content.
    and
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by KOKOSEK; 03-24-2019 at 11:13 AM.

  15. #15
    Forum Contributor
    Join Date
    11-29-2018
    Location
    Chennai
    MS-Off Ver
    MS office 2010
    Posts
    233

    Re: Need a macro for sending mails wishing brithday

    Hi thank u. I saved the pic in my g drive how do I call that pic in the macro.

    Please tell me how should I call that

  16. #16
    Forum Contributor
    Join Date
    11-29-2018
    Location
    Chennai
    MS-Off Ver
    MS office 2010
    Posts
    233

    Re: Need a macro for sending mails wishing brithday

    There?? Any update?

  17. #17
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Need a macro for sending mails wishing brithday

    I don't want to be rude but did you read my previous post?
    Change path and name here:

    Capture.JPG

  18. #18
    Forum Contributor
    Join Date
    11-29-2018
    Location
    Chennai
    MS-Off Ver
    MS office 2010
    Posts
    233

    Re: Need a macro for sending mails wishing brithday

    See I called like this saving the pic in the drive. But i didn't get pic in the mail. I gave the correct location


    I saved the pic in g drive and gave the code as "G:\pic.jpeg" but it didn't work.

    Also please note I am not well worst in vba. So apologies

  19. #19
    Forum Contributor
    Join Date
    11-29-2018
    Location
    Chennai
    MS-Off Ver
    MS office 2010
    Posts
    233

    Re: Need a macro for sending mails wishing brithday

    I finally fixed myself the picture.

    If I want to add mail Id in cc or BCC should we need a separate code to be written in macro.

  20. #20
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Need a macro for sending mails wishing brithday

    Birthday wishes with CC/BCC ?
    OK as You wish:

    Please Login or Register  to view this content.

  21. #21
    Forum Contributor
    Join Date
    11-29-2018
    Location
    Chennai
    MS-Off Ver
    MS office 2010
    Posts
    233

    Re: Need a macro for sending mails wishing brithday

    Thanks. But I am sorry. Where do I add the mail address.??

    After value should I have the mail Id

  22. #22
    Forum Contributor
    Join Date
    11-29-2018
    Location
    Chennai
    MS-Off Ver
    MS office 2010
    Posts
    233

    Re: Need a macro for sending mails wishing brithday

    Do u mean to say that if add the cc in H column the "-X" needs to be replaced with H???

  23. #23
    Forum Contributor
    Join Date
    11-29-2018
    Location
    Chennai
    MS-Off Ver
    MS office 2010
    Posts
    233

    Re: Need a macro for sending mails wishing brithday

    I finally find out. Thank you for all your patience in teaching me out.

    Thanks a ton !!!!

  24. #24
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Need a macro for sending mails wishing brithday

    X is number which declare 'shift' in relation in base column, can be + or -.
    For ex. if looping on column B, then offset (0,1) is column C and offset (0,-1) is column A, in general offset (row,column).

  25. #25
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Need a macro for sending mails wishing brithday

    You welcome.
    If you happy with solution please use Thread tools and mark thread as SOLVED.

  26. #26
    Forum Contributor
    Join Date
    11-29-2018
    Location
    Chennai
    MS-Off Ver
    MS office 2010
    Posts
    233

    Re: Need a macro for sending mails wishing brithday

    Hi just a small modification required.

    I don't want to send separate mails if 3 of the employee birthday falls on same day. Can we group and send as one mail to all 3 of them if their birthday falls on same day...

    Can u help me...

  27. #27
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Need a macro for sending mails wishing brithday

    Sure I can:
    Sorry that is on picture but due to html contains firewall blocked post.

    Changes are:
    - loop creates list of person with birthday and add them up together as 1 address
    - creating email now is after loop just once.

    Capture.JPG

  28. #28
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Need a macro for sending mails wishing brithday

    I hope you guys don't mind but I suggest a minor correction to avoid sending the mail again if you open the file the same day:

    Please Login or Register  to view this content.
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  29. #29
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Need a macro for sending mails wishing brithday

    Quote Originally Posted by Keebellah View Post
    I hope you guys don't mind but I suggest a minor correction to avoid sending the mail again if you open the file the same day:
    Absolutely right. But maybe you did not spot that OP choose option to run it manually, anyway always can forget that he has already sent it :-)

    BTW: why firewall blocked my post with this code and You were able to paste it?

  30. #30
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Need a macro for sending mails wishing brithday

    Yes, even if the OP use the Manual button the mail is sent again if there is no control.
    You paste the code using code tangs not html tags

  31. #31
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,743

    Re: Need a macro for sending mails wishing brithday

    yes as always - CODE /CODE
    If I use HTML /HTML will be fine? Cheers

  32. #32
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Need a macro for sending mails wishing brithday

    You use CODE for code HTML for HTML

  33. #33
    Forum Contributor
    Join Date
    11-29-2018
    Location
    Chennai
    MS-Off Ver
    MS office 2010
    Posts
    233

    Re: Need a macro for sending mails wishing brithday

    Thank u guys...

  34. #34
    Forum Contributor
    Join Date
    11-29-2018
    Location
    Chennai
    MS-Off Ver
    MS office 2010
    Posts
    233

    Re: Need a macro for sending mails wishing brithday

    I m unable to mark this as solved. Help me how do I mark that...

  35. #35
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,906

    Re: Need a macro for sending mails wishing brithday

    One other thing you can do is once the mail is sent set the date to the next year so you won't have to modify anything and it will mail again the next year

+ 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. Error while sending reminder mails using macro
    By nachiket1985 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-06-2017, 08:39 AM
  2. sending mails through lotus
    By vimalanathk in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-23-2013, 03:33 AM
  3. Conversion of macro code for sending mails from outlook to lotus notes
    By praveen2825 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-04-2013, 08:48 AM
  4. Replies: 1
    Last Post: 12-28-2012, 07:24 AM
  5. Replies: 1
    Last Post: 12-28-2012, 03:46 AM
  6. Auto Sending mails
    By Puneet in forum Excel General
    Replies: 0
    Last Post: 06-26-2006, 10:10 AM
  7. Sending mails
    By arunjoshi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-17-2005, 09: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