?
Solved

Sending email notification using dates in Excel

Posted on 2015-01-19
2
Medium Priority
?
494 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 52

Accepted Solution

by:
Rgonzo1971 earned 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

: Microsoft Office Collaborate for free and online versions of Microsoft  Word, Excel, Powerpoint, OneNote, Onedrive , Email, Calendar etc. In short we can say that Microsoft office is a suite of servers, applications and services developed by  Micr…
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
Viewers will learn the basics of slicers and timelines for both PivotTables and standard Excel tables in Excel 2013.
Video by: Zack
Viewers will learn the basics of using Excel Tables, the benefits found with them, and some pitfalls.

765 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