+ Reply to Thread
Results 1 to 6 of 6

Automatic outlook email on due date

  1. #1
    Registered User
    Join Date
    02-11-2017
    Location
    Singapore
    MS-Off Ver
    10
    Posts
    98

    Automatic outlook email on due date

    Hi ,

    I am bit new to VBA/ Macros.
    I am working on a tracker, where if the tasks/work not delivered, an email will be sent.

    In column F there is Yes / No options. If selected no and delivery date is today an email will be sent mentioning the Log No. Employee and Date of receipt to a specific email address.

    Excel attached.
    Thank you
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor kasan's Avatar
    Join Date
    07-22-2009
    Location
    Riga, Latvia
    MS-Off Ver
    Excel 2010
    Posts
    680

    Re: Automatic outlook email on due date

    Hi,
    You didn't show where you will keep e-mail adresses, so I got them in column G.
    This should work with Outlook (if Outlook is opened).

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    02-11-2017
    Location
    Singapore
    MS-Off Ver
    10
    Posts
    98

    Re: Automatic outlook email on due date

    I found one post in another forum. My expectation is bit different. I want all the rows where the due date in column E is today will be sent to one email address. Since I am bit new to macros. I need help to modify the code.

    Below code I copied from that forum post, not modified.
    Module 1:

    Sub eMail()
    Dim lRow As Integer
    Dim i As Integer
    Dim toDate As Date
    Dim toList As String
    Dim eSubject As String
    Dim eBody As String

    With Application
    .ScreenUpdating = False
    .EnableEvents = False
    .DisplayAlerts = False
    End With

    Sheets(1).Select
    lRow = Cells(Rows.Count, 4).End(xlUp).Row

    For i = 2 To lRow
    toDate = Replace(Cells(i, 3), ".", "/")
    If Left(Cells(i, 5), 4) <> "Mail" And toDate - Date <= 7 Then
    Set OutApp = CreateObject("Outlook.Application")
    Set OutMail = OutApp.CreateItem(0)

    toList = Cells(i, 4) 'gets the recipient from col D
    eSubject = "Project " & Cells(i, 2) & " is due on " & Cells(i, 3)
    eBody = "Dear " & Cells(i, 1) & vbCrLf & vbCrLf & "Please update your project status."

    On Error Resume Next
    With OutMail
    .To = toList
    .CC = ""
    .BCC = ""
    .Subject = eSubject
    .Body = eBody
    .bodyformat = 1
    '.Display ' ********* Creates draft emails. Comment this out when you are ready
    .Send '********** UN-comment this when you are ready to go live
    End With

    On Error GoTo 0
    Set OutMail = Nothing
    Set OutApp = Nothing
    Cells(i, 5) = "Mail Sent " & Date + Time 'Marks the row as "email sent in Column A"
    End If
    Next i

    ActiveWorkbook.Save

    With Application
    .ScreenUpdating = True
    .EnableEvents = True
    .DisplayAlerts = True
    End With
    End Sub

    This workbook code:
    Private Sub Workbook_Open()
    eMail
    End Sub

  4. #4
    Registered User
    Join Date
    02-11-2017
    Location
    Singapore
    MS-Off Ver
    10
    Posts
    98

    Re: Automatic outlook email on due date

    I am not sure if it is allowed to paste other forum link. My apology if it is against forum rule. below link-

    https://forums.techguy.org/threads/a...-file.1129238/

  5. #5
    Registered User
    Join Date
    02-11-2017
    Location
    Singapore
    MS-Off Ver
    10
    Posts
    98

    Re: Automatic outlook email on due date

    [QUOTE=kasan;4599537]Hi,
    You didn't show where you will keep e-mail adresses, so I got them in column G.
    This should work with Outlook (if Outlook is opened).

    Please Login or Register  to view this content.
    [/QUOTE

    Thank you
    Email address will be in 1 specific cell and there will be one 1 email address. Can you please advice where to insert this code. I already have another code in Sheet 1.

  6. #6
    Registered User
    Join Date
    02-11-2017
    Location
    Singapore
    MS-Off Ver
    10
    Posts
    98
    [QUOTE=ash2017;4599559]
    Quote Originally Posted by kasan View Post
    Hi,
    You didn't show where you will keep e-mail adresses, so I got them in column G.
    This should work with Outlook (if Outlook is opened).

    Please Login or Register  to view this content.
    [/QUOTE

    Thank you
    Email address will be in 1 specific cell and there will be one 1 email address. Can you please advice where to insert this code. I already have another code in Sheet 1.
    I have included the recipient email address in the code and it's working. Is there any code to include email address, email body text from sheet 2 and the email contents are in table as in the excel, maybe html format.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Automatic Outlook Email Based on Date in range of Cells HELP!!!!
    By benharley84 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-05-2016, 10:58 PM
  2. Can Excel can send automatic Email using Outlook?
    By gaurav1018 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-17-2013, 02:29 AM
  3. Can excel send automatic email to outlook ?
    By ronybony in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-10-2013, 02:23 AM
  4. Outlook folderid automatic email
    By wedwards in forum Outlook Programming / VBA / Macros
    Replies: 0
    Last Post: 12-04-2012, 12:08 PM
  5. Can excel send automatic email to outlook
    By gurj_sandhu in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-27-2012, 02:46 AM
  6. Automatic Email Alerts based on due date in Excel Via Outlook
    By lcmerten in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-24-2011, 03:32 AM
  7. stop security message with automatic email outlook
    By randell.graybill in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-07-2010, 01:02 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1