In my Excel file I have a reminder column, when the assigned date has passed then "Send Reminder" pops up in the column.
I am trying to send a reminder email.
I ran into trouble with "Sub or function not defined" but I fixed it by adding Solver into my references. Now when I click on macro > run , no email is sent.
Sub SendEmail()
Dim OutLookApp As Object
Dim OutLookMailItem As Object
Dim iCounter As Integer
Dim MailDest As String
Set OutLookApp = CreateObject("OutLook.application")
Set OutLookMailItem = OutLookApp.CreateItem(0)
With OutLookMailItem
MailDest = ""
For iCounter = 1 To WorksheetFunction.CountA(Column(4))
If MailDest = "" And Cells(iCounter, 4).Offset(0, -1) = "Send Reminder" Then
MailDest = Cells(iCounter, 4).Value
ElseIf MailDest <> "" And Cells(iCounter, 4).Offset(0, -1) = "Send Reminder" Then
MailDest = MailDest & ":" & Cells(iCounter, 4)
End If
Next iCounter
.BCC = MailDest
.Subject = "FYI"
.Body = "Reminder"
.Send
End With
Set OutLookMailItem = Nothing
Set OutLookApp = Nothing
End Sub
The columns are Name - Date - Reminder - Email (1, 2, 3, 4) and I am using Excel 2010.