+ Reply to Thread
Results 1 to 17 of 17

Send email when are date past

  1. #1
    Registered User
    Join Date
    07-09-2008
    Location
    Singapore
    Posts
    13

    Send email when are date past

    Hi,
    This is my first post in this forum. I hope to find the answer to my request.
    I have a workbook that records incoming mail and each of these mail need to be responded to. I like to have a macro that can automatically send a standard notification email when certain condition are met.
    In this workbook the date of receipt of mail is in Col. D and date of Reply in Col. E. If Col E is blank or 30 days later than Col. D a standard email is sent to the email account of the person in Col. F. Col. F shows the email address only.
    The body of the email is
    Please take note you have not responded to the letter sent by (Col. C addresses) as registered in the Letter Register.
    Appreciate all the help I can get.

  2. #2
    Forum Contributor SOS's Avatar
    Join Date
    01-26-2004
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    327
    Hi Hyperbole,

    You could use the following code (taken from Ron De Bruin's site) and adapted for you.

    Please Login or Register  to view this content.
    However since your request states you want this message sent when 1 of 2 conditions is met it will send an email if Col E is blank. Are you sure you want this?
    Hope this helps

    Seamus

  3. #3
    Registered User
    Join Date
    07-09-2008
    Location
    Singapore
    Posts
    13
    SOS,

    To be more precise the conditions should be the today date is more than 30 days than Col D and Col E is blank.

    As I am not very well verse with VBA I like to know if the codes you have graciously provided will loop through all the rows so that an email will be sent to each of the recipient if the conditions are met.
    Last edited by Hyperbole; 07-09-2008 at 03:52 AM.

  4. #4
    Registered User
    Join Date
    07-09-2008
    Location
    Singapore
    Posts
    13
    I like to reiterate that the conditions for which this macro should run are
    1. The current date is more than 30 after the date of the receipt of the date as shown in Col. D and if Col. E is blank. This mean only when both conditions are met will this macro execute. This macro should execute once the workbook is open.
    I tried the codes it only execute for one row it does not loop through all the rows so that an email is sent whenever the above conditions are met. My data start from row 8 downward. One important thing to consider and that is this macro should stop at the first empty row at the end of the data.

  5. #5
    Forum Contributor SOS's Avatar
    Join Date
    01-26-2004
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    327
    Hi Hyperbole,

    Try this amended code

    Please Login or Register  to view this content.
    Of course that code would have to be placed in the Workbook_Open part of your book. Post back if you need any help in that direction

  6. #6
    Registered User
    Join Date
    07-09-2008
    Location
    Singapore
    Posts
    13
    SOS,

    All seem to works well based on the current codes. I just like to push the performance a little bit more and that is to enable this macro to run whenever either this file is open or there is any change to the worksheet.

    Thanks in advance

  7. #7
    Forum Contributor SOS's Avatar
    Join Date
    01-26-2004
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    327
    Hyperbole,

    Are you sure?

    If the code is placed in the Workbook_Open event it will fire off emails to all concerned. That's good.

    However, if the code were to be added to Worksheet_Change as well then if the sheet changed the same people who got an email when the workbook was opened would get another email because of the change to the workbook.

    Make sense?

  8. #8
    Registered User
    Join Date
    07-09-2008
    Location
    Singapore
    Posts
    13
    SOS,

    While running the codes again I noticed this occurrence. If in Col. E somewhere down the line if I have a response date the code will just stop at that row without proceeding down the rows to test if the conditions are met.

    Please help.

  9. #9
    Forum Contributor SOS's Avatar
    Join Date
    01-26-2004
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2003
    Posts
    327
    Hyperbole

    Sorry mate - I can't replicate your problem.

    I put dates in cells D8 through to D20, put data in some cells in Col E and the code ran fine.

    Perhaps you could post a cut-down version of your workbook (taking out confidential info) and we could have a look at it.

  10. #10
    Registered User
    Join Date
    07-09-2008
    Location
    Singapore
    Posts
    13
    SOS,

    Sorry I off work now, I could only test out the worksheet again to see if I miss anything. Once again you have been a great help and I learned a lot today.

  11. #11
    Registered User
    Join Date
    07-09-2008
    Location
    Singapore
    Posts
    13
    SOS,

    I tried running the codes again and I encountered the same problem. I have attached a sample of the working file for you to peruse and see where have I done wrong. I also like to introduce another condition and that if Col F is "Y" then do not sent out the email. This is to remind myself that an earlier email has been sent.

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

  12. #12
    Registered User
    Join Date
    07-09-2008
    Location
    Singapore
    Posts
    13
    SOS,

    Finally, I got the macro to work after making some changes and further consultation with other gurus. Below are the codes.

    One final part I did not understanding and hopefully I can get some help. You said to put this codes in the Workbook_Open part of your book. Where is this?

    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    11-09-2006
    Posts
    65
    Thanks guys I was able to use the same code for a very similar situation.
    The only thing I am missing is to be able to put multiple email address into the TO: section.

    Can anyone give me a clue how to do it? I have tried serveral things, but nothing is working.

    Thanks

  14. #14
    Registered User
    Join Date
    11-09-2006
    Posts
    65
    Nevermind, I was able to figure it out.
    In case anyone else needs something similar:

    I selected column I as the location of emails that needed to be sent and created variable i.
    Then used a max of 2000 lines to check for emails that need to be sent.
    Then set .To = abc


    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    07-31-2008
    Location
    Regina
    Posts
    8
    in the line:
    Please Login or Register  to view this content.
    you need to put multiple addresses in the cell like this [email protected]; [email protected]; [email protected] and so on
    the other option is to change the to line to encompass multiple cells like below:
    Please Login or Register  to view this content.
    this & "; " & will need to go between each cell you want to add to a particualr email. there is also a variable way to do this so it just sends one email to everyone but this is a longer code involving finding all the emails in an array system storing them and then printing them to one cell that you designate to be the email .to

    Hope this helps you out.

  16. #16
    Registered User
    Join Date
    02-18-2010
    Location
    Pune
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Send email when are date past

    It was good, but instead of sending multiple emails, can I have a consolidate emial of all the records.

    sanjay

  17. #17
    Registered User
    Join Date
    02-18-2010
    Location
    Pune
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Send email when are date past

    Is there a way to list down all the rows (column 1 to 4) in a consolidated outlook mail, when entries in column (say 7) have past date mentioned in the list.



    regards
    sanjay

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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