+ Reply to Thread
Results 1 to 12 of 12

Auto Emails through VBA on Specific Date

  1. #1
    Registered User
    Join Date
    03-17-2015
    Location
    London
    MS-Off Ver
    2013
    Posts
    51

    Question Auto Emails through VBA on Specific Date

    Hi Guys,

    I have searched the forum and I couldn't find any specific/close topics.
    http://www.excelforum.com/excel-prog...-in-excel.html
    http://www.excelforum.com/excel-prog...ing-dates.html
    http://www.excelforum.com/excel-prog...rom-excel.html
    http://www.excelforum.com/excel-prog...tain-date.html


    Basically, I have a file which has column of deadlines. I need Excel to auto send emails to me with the data corresponding to that deadline.
    I have attached sample data. The Red Column are the deadlines, the data in the corresponding yellow cells are what I need emailing to me.

    Date of email to be sent: 7 days before deadline [column A]
    Time for emails to be sent: 09:30am
    To: [email protected] (testing purposes)
    Email Subject: "Product Deadline Approaching: [Date of deadline]"
    Body of email:

    "The below products are expiring

    Deadline: [DATE - Cell A4]
    Cycle:[DATE - Cell B4]

    Product Deadlines
    All Products
    T&C: [DATE - Cell C4]
    Ideal: [DATE - Cell D4]
    Late with agreement: [DATE - Cell E4]

    Primary Products
    All Products
    Product A: [DATE - Cell G4]

    Primary Products
    Other Products
    Product B: [DATE - Cell H4]
    Product C: [DATE - Cell I4]
    Product D: [DATE - Cell J4]

    Manufacturing Date
    Product A: [DATE - Cell L4]
    Product B [DATE - Cell M4]
    Product C [DATE - Cell N4]

    Thanks"

    let me know if you need more info

    Thank you for your help :)


    Tai
    Attached Files Attached Files

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Auto Emails through VBA on Specific Date

    This code can be used to delay send an email:

    Please Login or Register  to view this content.
    But it is a manual approach.

    A better approach might be to establish a 'count down' scenario based on the DATE. When the deadline date is reached, the macro auto-calls your email macro which draws from the list of criteria
    based in your table beginning with Column A. When you start your program each morning, the macro compares the current date with the list and sends the appropriate emails.

  3. #3
    Registered User
    Join Date
    03-17-2015
    Location
    London
    MS-Off Ver
    2013
    Posts
    51

    Re: Auto Emails through VBA on Specific Date

    Hi Logit,

    The countdown, do you mean have a sell with =Today() and if the dates match, the macro runs?
    Also - in terms of the body of the email, how can I specify the cells to match the same row as the deadline date?

    *sorry ive not done this before so its new territory for me

    Thanks
    Tai
    Last edited by Tai1001; 02-18-2017 at 12:00 PM.

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Auto Emails through VBA on Specific Date

    Re: "countdown"

    Please Login or Register  to view this content.

    Re: Which email to send based on date ... look at this:

    http://stackoverflow.com/questions/3...-based-on-date

    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    03-17-2015
    Location
    London
    MS-Off Ver
    2013
    Posts
    51

    Re: Auto Emails through VBA on Specific Date

    Hi Logit,

    Thanks for the attachment, i understand. Although, I am still confused about the body and subject of the email. The reason I want it to generate the email is because the sample data contains 5 rows, and my data is annual so having an email with the body that matches the date would be great help.

    Body of email:

    "The below products are expiring

    Deadline: [Value in Cell A4]
    Cycle:[Value in Cell B4]

    Product Deadlines
    All Products
    T&C: [Value in Cell C4]
    Ideal: [Value in Cell D4]
    Late with agreement: [Value in Cell E4]

    Primary Products
    All Products
    Product A: [Value in Cell G4]

    Primary Products
    Other Products
    Product B: [Value in Cell H4]
    Product C: [Value in Cell I4]
    Product D: [Value in Cell J4]

    Manufacturing Date
    Product A: [Value in Cell L4]
    Product B [Value in Cell M4]
    Product C [Value in Cell N4]

    Thanks"

    The above email is based on if today's date matched A4

    Thank you so much for your time.

    Tai

  6. #6
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Auto Emails through VBA on Specific Date

    Review these resources. The process can be used for any of the email entries (TO, FROM, BODY, CC, BCC, etc).

    http://stackoverflow.com/questions/2...r-selected-row

    http://stackoverflow.com/questions/2...excel-contents

    http://www.rondebruin.nl/win/s1/outlook/bmail5.htm



    Look at the TIPS section in this resource:
    http://www.rondebruin.nl/win/s1/outlook/bmail2.htm




    I searched for the above URLs using this: VBA Email body reference cell row content


    Take your time, study the resources. Everything you need is there. When you have something put together and need assistance come on back for more answers.

    Best

  7. #7
    Registered User
    Join Date
    03-17-2015
    Location
    London
    MS-Off Ver
    2013
    Posts
    51

    Re: Auto Emails through VBA on Specific Date

    Hi Logit,

    This is great, thanks for all your time and help.
    it's making sense. I will get back once I have generated a viable code

    Thanks
    Tai

  8. #8
    Registered User
    Join Date
    03-17-2015
    Location
    London
    MS-Off Ver
    2013
    Posts
    51

    Re: Auto Emails through VBA on Specific Date

    Hi Logit,

    I have figured it out, I have finished the code almost.
    However, I need last bit of help. My [.HTMLBody =] is tooooo Long.

    How can I break into multiple lines?
    I have attached the file, can you please have a look at the .HTMLBody code

    Just the last part left

    Thanks for all your help today.

    Tai
    Attached Files Attached Files
    Last edited by Tai1001; 02-18-2017 at 05:02 PM.

  9. #9
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Auto Emails through VBA on Specific Date

    There are probably several different ways to accomplish the targeted goal, but here is one way.

    Not certain I have the paragraph formatting correct. No doubt you are adept at manipulating the code. I am extremely impressed with your final product. GREAT JOB !

    How much experience do you have using VBA ?

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Logit; 02-18-2017 at 07:01 PM.

  10. #10
    Registered User
    Join Date
    03-17-2015
    Location
    London
    MS-Off Ver
    2013
    Posts
    51

    Cool Re: Auto Emails through VBA on Specific Date

    Hi Logit,

    Thank you so much for your help. I tweaked it a little but it fully works :D

    I also added the below so I can select a range of email addresses rather than having a fixed person.

    Really appreciate your help and supportive comments. I am amateur to be honest, I just read the sites you gave and put the pieces together

    Thanks

    Please Login or Register  to view this content.

  11. #11
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,014

    Re: Auto Emails through VBA on Specific Date

    Keep up the great work ! Nicely done.

    If you haven't already, please mark this thread as solved. Up top, right side, THREAD TOOLS

  12. #12
    Registered User
    Join Date
    03-17-2015
    Location
    London
    MS-Off Ver
    2013
    Posts
    51

    Re: Auto Emails through VBA on Specific Date

    Thanks Logit
    Speak soon

    Tai

+ 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. Excel vba to auto-send customer emails (duplicate emails issue)
    By nadz84 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-29-2015, 10:08 AM
  2. Send Emails once expiry date is reached, and generate report based on emails sent
    By demonicscorpion in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-18-2014, 05:36 AM
  3. Help! Macro that sends auto emails based on date
    By just2005 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-17-2014, 08:20 AM
  4. Auto generating emails based on date in cell
    By Snaga in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-10-2014, 12:41 PM
  5. Auto Send Emails Based on Due Date
    By Nuclearman83 in forum Excel General
    Replies: 5
    Last Post: 03-23-2012, 02:54 PM
  6. Auto update of date in a specific cell?
    By spavined in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-07-2009, 01:52 PM
  7. Send Mail Merge Auto-Emails based on date
    By Phillycheese5 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-17-2005, 11:40 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