+ Reply to Thread
Results 1 to 12 of 12

Send outlook email based on employee start date?

  1. #1
    Registered User
    Join Date
    02-19-2021
    Location
    Finland
    MS-Off Ver
    -
    Posts
    4

    Lightbulb Send outlook email based on employee start date?

    Hi,

    I'm new with VBA and I've been working on a macro to help automate sending a welcome email to new employees in my company based on their start date. I successfully managed to mess up the macro completely last Friday by trying to edit it to take the start date into account, so I'm in a desperate need of help from VBA experts.

    I'll attach an example excel to this message, if this let's me do it, so you get the idea (without the macro though since that is gone, but it was really basic). I managed to create the basic macro containing the message, recipient, cc/bcc and attachments, but there I ran out of knowledge.

    Basically I'd need the macro to:
    -> check the start date of the employee in the row, and if its today or within ~3 days to the future (I'll fix the formula in column D, it's just there now to show you what I was thinking about), send the employee a welcome email and add their supervisor as a cc. If the date in the column is in the past, the macro shouldn't send email.

    Any idea if this is even possible? I'm aware that I'll propably have to run the macro, but that's okay as long as it would check who to send the emails to.

    Thanks, if someone can help me forward with this one

    vba-help.PNG
    VBA-example-excel.xlsx
    Last edited by emaii; 02-23-2021 at 04:46 AM. Reason: SOLVED

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,719

    Re: Send outlook email based on employee start date?

    Please include the code that you already have. Your attached file does not have any code.

    If you paste code into your post please use code tags.

  3. #3
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Send outlook email based on employee start date?

    Do you want to run the macro manually? You could have a macro to send the email automatically when the formula in column D changes to "Send".
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,719

    Re: Send outlook email based on employee start date?

    Quote Originally Posted by Mumps1 View Post
    You could have a macro to send the email automatically when the formula in column D changes to "Send".
    How would you detect that?
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  5. #5
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Send outlook email based on employee start date?

    Could use a Worksheet_Calculate event based on the formula in column D.

  6. #6
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,176

    Re: Send outlook email based on employee start date?

    attached is solution.
    run macro: Check4Anniv
    Attached Files Attached Files

  7. #7
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,719

    Re: Send outlook email based on employee start date?

    Quote Originally Posted by Mumps1 View Post
    Could use a Worksheet_Calculate event based on the formula in column D.
    I have not see ranman256's solution yet, but if you check every cell for "Send" when the sheet is recalculated you would repeatedly send to destinations that you've already sent to. You would need some sort of indicator that the email has been sent in addition to what the OP showed.

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,719

    Re: Send outlook email based on employee start date?

    Quote Originally Posted by ranman256 View Post
    attached is solution.
    • This solution adds a "sent" date which solves the problem I raised in my previous post. This solution could also be modified to run every time the Calculate event occurs.
    • No need to zip this
    • I suggest that people post .xlsx and .xlsm formats rather than .xls, which can cause compatibility issues in some cases. It became obsolete 13 years ago.

  9. #9
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Send outlook email based on employee start date?

    when the sheet is recalculated you would repeatedly send to destinations that you've already sent to
    @6StringJazzer
    Now why didn't I think of that?

  10. #10
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,719

    Re: Send outlook email based on employee start date?

    Quote Originally Posted by Mumps1 View Post
    @6StringJazzer
    Now why didn't I think of that?
    You probably did but since the post didn't mention it I thought I would.

  11. #11
    Registered User
    Join Date
    02-19-2021
    Location
    Finland
    MS-Off Ver
    -
    Posts
    4

    Re: Send outlook email based on employee start date?

    Thanks a lot! I'll test this one out later today!

  12. #12
    Registered User
    Join Date
    02-19-2021
    Location
    Finland
    MS-Off Ver
    -
    Posts
    4

    Re: Send outlook email based on employee start date?

    Quote Originally Posted by ranman256 View Post
    attached is solution.
    run macro: Check4Anniv
    This worked perfectly! Thank you so much, you just made my life so much easier!

+ 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. Send automatic Outlook email based on Due Date
    By WesternPartner64 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-02-2018, 10:11 PM
  2. Send email automatically through outlook on near due date with attachment
    By janakkaneria in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-30-2018, 11:22 AM
  3. Macro to send an email via Lotus Notes to an employee based upon cell values
    By kodonnell in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-02-2015, 12:43 PM
  4. Replies: 0
    Last Post: 04-14-2015, 05:44 PM
  5. Set outlook to send email when due date is reached
    By Camps1 in forum Excel General
    Replies: 5
    Last Post: 10-09-2014, 06:38 AM
  6. [SOLVED] Send email from excel using outlook on a specific date
    By Eyeson in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 07-09-2014, 01:47 AM
  7. How To Have Email Notification 30 Days Before Due Date Send To Outlook
    By Blizzard13 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-23-2013, 10:20 AM

Tags for this Thread

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