Results 1 to 5 of 5

Thread: Sending emails specific date with excel and cdo

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2011
    Posts
    3

    Sending emails specific date with excel and cdo

    I have an excel spreadsheet with a list of resources names (A2:A25), Email list (B2:B25) start dates (C2:C25) and a message concerning their task.(D225) I want to trigger and event that sends an email three days before the event date. I have done this with limited success going through outlook. Would rather use cdo and skip Outlook from what I have read. The workbook could remain open. This could run on either and xp machine or a server 2003. Would appreciate your help.

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Sending emails specific date with excel and cdo

    you could run a daily windows scheduled task, that can run a vbs script (or vb app), to automate the specific workbook (opened or closed) and send the emails as required
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2011
    Posts
    3

    Re: Sending emails specific date with excel and cdo

    Using the scheduled task sounds like the right approach to take. Do you have a vb script available that would work for what I am wanting to accomplish?
    Thanking you in advance

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Sending emails specific date with excel and cdo

    Do you have a vb script available that would work for what I am wanting to accomplish?
    no, but it would be fairly basic

    use getobject to automate the specific workbook
    vb Code:
    1. set mybook = getobject(fullpath\filename)
    2. set sht = mybook.sheets(1)
    3. for each c in sht.range("c2:c25")
    4.   if datediff("d", date, c) = 3 then  ' 3 days, may require reversal of date and c
    5.     ' send email
    6.   end if
    7. next
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  5. #5

    Thread Starter
    New Member
    Join Date
    Apr 2011
    Posts
    3

    Resolved Re: Sending emails specific date with excel and cdo

    Thank you for the quick response. Used outlook and did get it to work.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width