I have tried to make this an automated email and keep getting errors. Can someone look at my code and tell me what I am doing wrong? Thank you in advance to anyone able to help me, I am a complete beginner!
My code for the email:
[INDENT]Sub SendReminderMail()
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(Columns(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).Value
End If
Next iCounter
.to = "the email id to whom you want to send"
.CC = "The email id to whom to put CC"
.BCC = "The email id"
.Subject = "FYI"
.Body = "Renewal due, see Lisa."
.Send
End With
Set OutLookMailItem = Nothing
Set OutLookApp = Nothing
End Sub
My code for the automated button:
Private Sub CommandButton1_Click()
For Each cell In Range("D2:D100")
If cell.Value < Date + 14 And cell.Value <> "" Then
cell.Interior.ColorIndex = 3
cell.Font.ColorIndex = 2
cell.Font.Bold = True
Application.Speech.Speak ("send reminder to")
'cell.Value = cell.Offset(0,-2).Value
Application.Speech.Speak (cell.Offset(0, -2).Value)
End If
' Application.Speech.Speak ("cell.text")
Next
SendReminderMail
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub
Bookmarks