Closed Thread
Results 1 to 34 of 34

Automatic email from Excel

  1. #1
    Registered User
    Join Date
    05-29-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    13

    Automatic email from Excel

    I have an excel sheet which contains user details and date of expiry of a particular service. I would like to send an email to user when the date of expiry is met. Can you please help me with this. I have searched quite a few solutions but nothing has helped me. I have very little knowledge in VB.

    Any help is much appreciated.

    Thanks.
    Last edited by hasini; 06-05-2009 at 04:25 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Automatic email from Excel

    Hello hasini,

    Welcome to the Forum!

    Because you aren't very familiar with VBA, it would be better if you post your workbook. The needed code can then be added directly into your workbook.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    05-29-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Automatic email from Excel

    Hi,
    Please find attached the sheet as requested. I want to send an automatic email to the user 5 days before the expiry date.

    Thanks
    Attached Files Attached Files

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Automatic email from Excel

    Hello hasini,

    The attached workbook has the macros shown here already installed. The macro to check for expiry dates runs when the workbook is first opened. It can also be run at anytime by clicking the button on "Sheet1".

    The emails are sent using CDO (Collaboration Data Objects) instead of using Outlook. This will prevent the security message from appearing each time an email is sent. You will need to add some information to the macro before it will send the email. These areas are marked in red. I am assuming your are connecting to your email server remotely. If not, let me know.

    Macro Code to Send Emails
    Please Login or Register  to view this content.
    Macro to Check Expiry Dates
    Change the subject line and message to what you want sent out. Also, if you change the worksheet name or the layout of your table be sure to make the change in the macro. See areas marked in red.
    Please Login or Register  to view this content.
    Workbook Open Event
    This runs the macro when the workbook first opens.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    05-29-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Automatic email from Excel

    Hi Leith,
    I have made the changes to the macro and tried running the same, however, nothing is happening. Also, I want to use my exchange server for sending the mails.

    Thanks

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Automatic email from Excel

    Hello hasini,

    Nothing happens, not even an error message? I will need to look into setting this up for sending email on the Exchange server. While CDO does prevent the annoying security messages, it isn't as easy to use as Outlook.

  7. #7
    Registered User
    Join Date
    05-29-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Automatic email from Excel

    Hi Lieth,
    There is no error message coming. Can you please help me with this.

    Thank you so much.

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Automatic email from Excel

    Hello hasini,

    I could rewrite the macro to use Outlook, if you don't mind the answering security messages. If you only have a few emails it isn't so bad, but if you have a large list with the possibility of large number of emails then we need another approach.

  9. #9
    Registered User
    Join Date
    05-29-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Automatic email from Excel

    That should be fine as I don't have many mails to be sent.

  10. #10
    Registered User
    Join Date
    05-29-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Automatic email from Excel

    Hi Leith,

    Can you please provide me the new code.

    Thanks

  11. #11
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Automatic email from Excel

    Hello hasini,

    Sorry for the delay. I had took take my wife to her doctor's appointment, and then to work. he attached workbook contains the Outlook macro.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    05-29-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Automatic email from Excel

    Hi Leith,

    Thank you so much for the macro, however it still doesn't do anything. Can you please let me know how to run the same.

    Thanks.

  13. #13
    Forum Contributor
    Join Date
    11-07-2005
    Posts
    280

    Re: Automatic email from Excel

    Hi,

    Very nice useful code form you Leith Ross,,

    Thank you so much,

  14. #14
    Registered User
    Join Date
    05-29-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Automatic email from Excel

    Hi Leith,
    The macro is working fine. Can you please let me know what modifications have to be made if I want to send a mail 5days before the expiry date.

    Thanks

  15. #15
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Automatic email from Excel

    Hello hasini,

    I have added a column to the worksheet o hold the date-time stamp for the email being sent. This will prevent the email from being sent more than once. The atached workbook has this macro and the worksheet change alreay installed.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  16. #16
    Registered User
    Join Date
    05-29-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Automatic email from Excel

    Hi Leith,

    Thank you so much for the help. The macro is working absolutely fine. I need one final help from you. If i want to add the expiry date to the msg body how do i do it.

    Thanks

  17. #17
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Automatic email from Excel

    Hello hasini,

    Can you show me what the mail body text should look like with the expiry date added?

  18. #18
    Registered User
    Join Date
    05-29-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Automatic email from Excel

    The body should look like this.

    Hi <<Name>>,
    Your certificate is going to expire on <<Expiry Date>>.
    Please get the same renewed.

    Regards,
    Hasini

  19. #19
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Automatic email from Excel

    Hello hasini,

    Here is the macro with the updated mail body containing the expiry date. It has been added to the attached workbook.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  20. #20
    Registered User
    Join Date
    05-29-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Automatic email from Excel

    Hi Leith,

    Thank you so much for the help provided.

  21. #21
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Automatic email from Excel

    Hello hasini,,

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

  22. #22
    Registered User
    Join Date
    05-29-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Automatic email from Excel

    I have done that and Thank you once again for your help.

  23. #23
    Forum Contributor
    Join Date
    11-07-2005
    Posts
    280

    Re: Automatic email from Excel

    Hi,

    I think the code is perfect now .. Thanks a lot Leith Ross,

    Regards,

  24. #24
    Registered User
    Join Date
    05-29-2009
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Automatic email from Excel

    Hi Leith,
    Can you please help me in adding From and CC field to this macro.

    Thanks

  25. #25
    Forum Contributor
    Join Date
    11-07-2005
    Posts
    280

    Re: Automatic email from Excel

    Hi,

    Mr. Leith Ross, I have added some features to your codes (Check the red colored lines), in order to reach need which is checking Expiry Dates in a range of ten columns not only one:

    1- Allow one person only to send the e-mail.
    2- If we are sending e-mails to employees on the same exchange server, we don't have to use the full e-mail address (Login ID is enough).
    3- Add a comment to the cell contains the date with Sending Details.

    You can also Add CC and BCC copies to the code (See The blue colored lines).


    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by LoveCandle; 06-07-2009 at 05:20 AM.

  26. #26
    Registered User
    Join Date
    06-05-2009
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Automatic email from Excel

    I also have a similar problem, tried to integrate this code but was not able to, can somebody also check my thread? http://www.excelforum.com/excel-prog...ml#post2106108

    thanks

  27. #27
    Registered User
    Join Date
    07-30-2010
    Location
    South Pole
    MS-Off Ver
    Excel 2010
    Posts
    99

    Re: Automatic email from Excel

    @Leith Ross ,

    You guy rocks !
    Thanks for sharing this.
    You helped me so far.
    Cheers

  28. #28
    Registered User
    Join Date
    06-20-2012
    Location
    Maputo
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Automatic email from Excel

    Hi Leith,

    Thanks for this code. Could you please help adding CC?

    Thanks, Helder

  29. #29
    Registered User
    Join Date
    03-08-2012
    Location
    Roscrea, Ireland
    MS-Off Ver
    2007
    Posts
    4

    Re: Automatic email from Excel

    Hi all,

    I have tried unsuccessfully to modify this spreadsheet to generate e-mails automaticaly to notify dentists when the expiry date of their emergency drugs falls due.
    I am doing this for myself and a number of colleagues. You cdan see from my efforts attached that I have created a different sheet for each drug. I have not copied the macros from the 1st sheet to all the others because I cannot get it working. I know that this thread is a bit old but it is the nearest to what i need that I can find, Any help appreciated.
    Attached Files Attached Files

  30. #30
    Registered User
    Join Date
    11-05-2008
    Location
    Adelaide, Australia
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    67

    Re: Automatic email from Excel

    Pgor,

    You need to create a new thread for your query.

  31. #31
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Automatic email from Excel

    Thanks Sarails.

    pgor,

    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  32. #32
    Registered User
    Join Date
    03-08-2012
    Location
    Roscrea, Ireland
    MS-Off Ver
    2007
    Posts
    4

    Re: Automatic email from Excel

    Sorry about that, I am new to the forum. I have now started a new thread.

  33. #33
    Registered User
    Join Date
    01-13-2013
    Location
    Bangalore
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Automatic email from Excel

    Leith Ross: Your Work is pretty Awesome. Thanks for this thing. It works absolutely wonderful.
    Just to add cherry to the cake, can we by any chance have a sheet with multiple columns of reminders which we have send
    In your example. when i send an email, it will show the sent status , can i have such multiple columns to have a track of no of reminders i have sent.

    Thanks A ton for your wonderful work. Your work, believe me is a life saving sheet. Because it saves enormous amount of my time

  34. #34
    Registered User
    Join Date
    04-21-2015
    Location
    Accra, Ghana
    MS-Off Ver
    2010
    Posts
    1

    Re: Automatic email from Excel

    wow am a bit confused, ok honestly am totally confused but i would like your help anyways.we have a software that notifies our clients when their investment certificates with us is about to expire.would love it if you could hep me out outside the software to send them a notification on the exact day the certificates expires asking them to send a rollover instruction or not depending on what they want to be done.

Closed 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