+ Reply to Thread
Results 1 to 8 of 8

Send email based on due dates

Hybrid View

JohnPorter85 Send email based on due dates 11-18-2019, 08:08 AM
Pepe Le Mokko Re: Send email based on due... 11-18-2019, 09:11 AM
JohnPorter85 Re: Send email based on due... 11-18-2019, 09:58 AM
JohnPorter85 Re: Send email based on due... 11-18-2019, 01:34 PM
saravnepali Re: Send email based on due... 11-18-2019, 07:04 PM
JohnPorter85 I don’t sorry Column A... 11-26-2019, 06:31 AM
saravnepali Re: Send email based on due... 11-26-2019, 06:50 AM
saravnepali Re: Send email based on due... 11-26-2019, 07:08 AM
  1. #1
    Valued Forum Contributor saravnepali's Avatar
    Join Date
    01-14-2019
    Location
    Sydney Australia
    MS-Off Ver
    2010
    Posts
    447

    Re: Send email based on due dates

    Try This variation to your code
    Private Sub Workbook_Open()
    
       
        Dim i As Variant
        Dim OutApp, OutMail As Object
        Dim strto, strcc, strbcc, strsub, strbody As String
        Dim today As Date
        Set OutApp = CreateObject("Outlook.Application")
        OutApp.Session.Logon
        Set OutMail = OutApp.CreateItem(0)
        today = Date
        
        For i = 3 To Range("C65536").End(xlUp).Row
           ' If Cells(i, 43) <> "Y" Then
                If (Cells(i, 3) - 30) < today Then
                    strto = Cells(i, 4).Value 'email address
                    strsub = "PSR Contractor - Due date " & Cells(i, 3).Value 'email subject
                    strbody = "Dear " & Cells(i, 2).Value & vbNewLine & "please update your project status" 'email body
                    
                    With OutMail
                        .To = strto
                        .Subject = strsub
                        .Body = strbody
                        .Send
                       ' .display
                                        
                    End With
                    On Error Resume Next
                    Cells(i, 5) = "Mail Sent " & Now()
                    'Cells(i, ) = "Y"
                    
                End If
            'End If
        Next
        
        Set OutMail = Nothing
        Set OutApp = Nothing
        
    
    End Sub
    Attached Files Attached Files
    If you think someone helped you, click on the "* Add Reputation" as a way to say thank you.

    If your problem is solved, go to Thread Tools and select Mark This Thread Solved

+ 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. Create Email to automaticaly send email based on Renew Date
    By Howardc1001 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-30-2019, 02:05 AM
  2. Send email based on dates to hide columns
    By Jamesraywebber85 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-20-2019, 05:36 PM
  3. send automatic email on multible dates until checked off completed.
    By jz75455 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-16-2016, 03:53 AM
  4. Send Email Based on 2 Dates
    By onelifestyle in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-22-2015, 04:16 PM
  5. Send delayed email from dates in cell's in excel
    By Ryan Nielsen in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-05-2013, 03:06 PM
  6. Conditional formating that will send email to 5 oldest dates in a column
    By ayan1988 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-23-2013, 11:25 AM
  7. Check dates and then send email to user.
    By dutchdog in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-10-2012, 03:36 AM

Tags for this Thread

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