• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

email or reminder for a certain date

rjwalters

New Member
Ok so I have accounts in Column A. For those accounts I have due dates, which I have conditional formatting set up to change cell color.


My question is there an easy way to send myself an email 45 days prior to the due date. I am using lotus notes and it is ok if notes has to be open as I leave notes and excel open all day.


Just wondering if its possible, which I am sure it is!


Thanks
 
Hi rjwalters,


As you have said that your excel opens everyday, your requirement is possible to achieve through macro.


May I request you to please share your sample file with us before we go ahead further?


Meanwhile, you may want to have a look at the following website:

http://www.rondebruin.nl/sendmail.htm


Kaushik
 
Ok so in column A1 I have Samsung.

Column B1 I have 11/15/2012


I want an email reminder 45 days prior to that date. The email can say anything as I will adapt it to the page I am working on.
 
Hi rjwalters,


Sorry for replying you so late...got stuck in some other work....Let's get into the business now...


What we can do is, we can subtract the due data from current date and check if it is =45 or not. If it is true(i.e., 45 days prior to due date) then email should fire.


Assuming, your due date is at B2( B1 is your header),45 days from now would be 12/26/2012; so plz place the same in B2; below here is your code:


Sub SendEmailAlrt()


Dim CheckDate As Long

Dim OutApp As Object

Dim OutMail As Object

Dim strbody As String


'Calculate the difference between due date and current date


CheckDate = DateDiff("d", Format(Date, "mm/dd/yyyy"), Sheet1.Range("B2").Value)


'If the condition is true then send e-mail else do not d anything


If CheckDate = 45 Then


Set OutApp = CreateObject("Outlook.Application")

Set OutMail = OutApp.CreateItem(0)


strbody = "Hi Dear" & vbNewLine & vbNewLine & _

"Your first line of message" & vbNewLine & _

"Your second line of message" & vbNewLine & _

"Your third line of message" & vbNewLine & _

"Your fourth line of message"


On Error Resume Next

With OutMail

.To = "replace this statement with the desired e-mail ID"

.CC = ""

.BCC = ""

.Subject = "Your Subject line will go here"

.Body = strbody

.Send

End With

On Error GoTo 0


Set OutMail = Nothing

Set OutApp = Nothing


Else: Exit Sub


End If


End Sub


Note: 1)Please remember to check "Microsoft outlook 12.0 object library" before running the code. To do the same press alt+F11 from key board, click on "Tools", select "reference" and look for "Microsoft outlook 12.0 object library" ( you might have different version number per the version of excel you are using).


2)In case you are checking the post tomorrow or day after, change the due date at B2 accordingly to fit it into "prior to 45 days category"


3)Remember to put your desired e-mail ID in .to= partof the code


Suggestion/thoughts: This is a basic code structure (not very dynamic in nature) I have shared with you. You might require lot of check points like for each and every entry the code should run at one go; to do the same we need to incorporate Looping concept; and the entries for which email is sent, you might need to have a marker in the corresponding cell saying "email sent" kind of stuff.


If these things are required, I would request you to share your sample workbook with us to provide you the more customized code.


Regards,

Kaushik
 
Back
Top