I am trying to write a VBA code to send auto email reminders from an excel sheet however I am getting some error. Below is the code:
Dim olapp As Outlook.Application
Set olapp = CreateObject("Outlook.Application")
Dim olmail As Outlook.MailItem
Set olmail = olapp.CreateItem(olMailItem)
Dim maildest As String
Dim i As Integer
For i = 2 To 5
maildest = ""
maildest = Cells(i, 5).Value
olmail.To = maildest
olmail.Subject = "is it running yet?"
olmail.Body = "A gentle reminder that XXX tasks are still pending"
Set olmail = Nothing
Set olapp = Nothing
Could you kindly guide as to what is wrong with the code? The loop never functions.