Solved

Sending email notification using dates in Excel

Posted on 2015-01-19
2
227 Views
Last Modified: 2015-01-23
Hello,

Pl refer to the attached sheet. What am trying to do is I want that Excel sends email notification 30 days before the Expiry date in the field D to the email IDs in field F. I have done some backend scripting taking lead from few websites but its not working so turned to Expert Exchange.!

Can someone help. It would be great if the email subject picks up name of the document in from cell B.

Thanks
Myinfo
SOP-TRACKER.xlsm
0
Comment
Question by:Advait Kawthalkar
2 Comments
 
LVL 48

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 40559135
Hi,

pls try (first code send an email to everybody and 2nd an email to each address

Sub SendReminderMail()
Dim OutlookApp As Object
Dim OutLookMailItem As Object
Dim iCounter As Integer
Dim MailDest As String
Dim Documents As String


Set OutlookApp = CreateObject("Outlook.application")
Set OutLookMailItem = OutlookApp.CreateItem(0)

With OutLookMailItem
    MailDest = ""
    Documents = ""
    For Each cell In Range(Range("F2"), Range("F" & Cells.Rows.Count).End(xlUp))
        If cell.Offset(0, -2) = "Expires next month" Then
            MailDest = cell.Value & ";"
            Documents = cell.Offset(0, -4).Value & ", "
        End If
    Next
    MailDest = Left(MailDest, Len(MailDest) - 1)
    Documents = Left(Documents, Len(Documents) - 2)
    
    .BCC = MailDest
    .Subject = "Your SOP is expiring (" & Documents & ")"
    .Body = "Reminder : Your SOP is going to expire in a month"
    .Display ' .Send
End With

Set OutLookMailItem = Nothing
Set OutlookApp = Nothing

End Sub
Sub SendReminderMail1()

End Sub
Dim OutlookApp As Object
Dim OutLookMailItem As Object
Dim iCounter As Integer
Dim MailDest As String
Dim Documents As String


Set OutlookApp = CreateObject("Outlook.application")
Set OutLookMailItem = OutlookApp.CreateItem(0)

With OutLookMailItem
    MailDest = ""
    Documents = ""
    For Each cell In Range(Range("F2"), Range("F" & Cells.Rows.Count).End(xlUp))
        If cell.Offset(0, -2) = "Expires next month" Then
            MailDest = cell.Value
            Documents = cell.Offset(0, -4).Value
        End If
    
        .BCC = MailDest
        .Subject = "Your SOP is expiring (" & Documents & ")"
        .Body = "Reminder : Your SOP is going to expire in a month"
        .Display ' .Send
        Next
End With

Set OutLookMailItem = Nothing
Set OutlookApp = Nothing

Open in new window

Regards
0
 

Author Closing Comment

by:Advait Kawthalkar
ID: 40567690
Thanks Rgonzo1971
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Moving applications to the cloud or switching services to cloud-based ones, is a stressful job.  Here's how you can make it easier.
What is Backup? Backup software creates one or more copies of the data on your digital devices in case your original data is lost or damaged. Different backup solutions protect different kinds of data and different combinations of devices. For e…
Viewers will learn the basics of using filtering and sorting in Excel 2013.
Viewers will learn the basics of printing in Excel 2013 and how to adjust some common settings.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now