Results 1 to 2 of 2

Macro to send email based on date won't run

Threaded View

  1. #1
    Registered User
    Join Date
    08-21-2013
    Location
    Prospect, Ohio
    MS-Off Ver
    Excel 2007
    Posts
    16

    Macro to send email based on date won't run

    Hello,

    Please can anyone help with this code, I cannot see my error. Thank you so much for your help.

    I have a spreadsheet that tracks new hire orientation and we would like to follow up with them after they have been here a certain period of time. I have attached the work sheet. I have searched all the forums and came up with the following macro but it doesn't work. Can anyone help? Thanks....

    Private Sub Workbook_Open()
    Dim ce As Range, i As Long
        Dim OutApp As Object
        Dim OutMail As Object
        Dim strto As String, strcc As String, strbcc As String
        Dim strsub As String, strbody As String
    
        For i = 2 To Sheets("Follow-up").Range("e65536").End(xlUp).Row
        'checks cell from col E ....... .....and cell form col G is empty
               If Cells(i, 5).Value = Date + 14 And Cells(i, 7) = "" Then
                Set OutApp = CreateObject("Outlook.Application")
                OutApp.Session.Logon
                Set OutMail = OutApp.CreateItem(0)
            
                                
                End With
        
                With OutMail
                    .To = Cells(i, 7)
                    .CC = strcc
                    .BCC = strbcc
                    .Subject = "Safety Follow-up"
                    .Body = "Orientation Safety Follow-up"
                    .Send
                    
                            Cells(i, 5).Select 'col E
                            With Selection.Font
                             .Color = vbBlack
                             .TintAndShade = 0
                             End With
                            Cells(i, 8) = "Sent at:" & Now() 'col H
                End With
       
                Set OutMail = Nothing
                Set OutApp = Nothing
          End If
          Next i
    End Sub

    Follow-Up Safety.xlsm
    Last edited by lisanoe; 01-24-2014 at 12:25 PM. Reason: Noone has answered me

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Send email based on date value
    By Billie Mac in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-10-2016, 07:56 AM
  2. [SOLVED] Send email based on deadline date
    By SAsplin in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 06-09-2014, 05:53 PM
  3. Automatically send an email based on the value of a cell and/or trigger date
    By psn.arya in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-05-2013, 06:17 PM
  4. excel send an email based on cell value (Date)
    By Arpanasiaworld in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-26-2013, 07:59 PM
  5. Command button to send an email based on a specific date
    By suetuff in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-29-2013, 04:25 PM

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