[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Sending email notification using dates in Excel

Posted on 2015-01-19
2
Medium Priority
?
564 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 53

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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

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 various types of data validation for different data types in Excel 2013.
Viewers will learn the basics about Excel 2013’s new Flash Fill feature.

650 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