+ Reply to Thread
Results 1 to 10 of 10

Script or Macro to send an email

  1. #1
    Registered User
    Join Date
    08-25-2011
    Location
    Chennai, India
    MS-Off Ver
    Excel 2007
    Posts
    31

    Script or Macro to send an email

    Hi,

    I am looking for a script that should send an automated email to the email ID in the row with subject line as Description (Column B). It need to check for the end date (Column D)and if it is less than 2 days to the current date it should send an email.

    Body of the email need to be as below
    Dear Owner (Column F),

    Reminder!! You have 2 more days to complete this task.

    Regards,
    Pradeep Kodali


    Please help me in getting a Macro or Script for this.

    I have attached the Spread Sheet for your reference.

    Thanks in advance for your help!!

    Regards,
    Pradeep Kodali
    Attached Files Attached Files

  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,258

    Re: Script or Macro to send an email

    Hello Pradeep,

    This macro will send the emails out when today's date is 2 days before the end date. A button has been added to the sheet to run the macro. The attached workbook has the macro added.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Leith Ross; 09-01-2011 at 07:21 PM. Reason: Corrected date difference problem and typo
    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
    08-25-2011
    Location
    Chennai, India
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Script or Macro to send an email

    Hello Leith,

    Thanks for the script. How ever I am unable to send the emails and getting error as "Runtime Error 5: invalid procedure call or argument" and it shows error in below code. Please have a check.

    If DateDiff(d, Now(), Cell) = 2 Then

    Regards,
    Pradeep Kodali

  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,258

    Re: Script or Macro to send an email

    Hello Pradeep,

    I guess the change didn't save. Here is what the line should be. the small letter d should be in quotes.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-25-2011
    Location
    Chennai, India
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Script or Macro to send an email

    Hi Leith,

    Now its throughing RUNTIME error @ .To = Cells.Offset(0, 3) 'Column "G"

    Regards,
    Pradeep K

  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,258

    Re: Script or Macro to send an email

    Hello Pradeep,

    That should be Cell and not Cells. My typing is not very good.
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    08-25-2011
    Location
    Chennai, India
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Script or Macro to send an email

    Thanks Leith!! Its working now as desired.

    Will it only work for MS Outlook Client or web emails as well (eg: Gmail)?

    Thanks!
    Pradeep Kodali

  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,258

    Re: Script or Macro to send an email

    Hello Pradeep,

    The macro is written for Outlook. Other email clients, like Gmail, can receive the email once it has been sent.

  9. #9
    Registered User
    Join Date
    08-25-2011
    Location
    Chennai, India
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Script or Macro to send an email

    Thanks Leith!!

  10. #10
    Registered User
    Join Date
    08-25-2011
    Location
    Chennai, India
    MS-Off Ver
    Excel 2007
    Posts
    31

    [SOLVED] Script or Macro to send an email

    Thanks once again!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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