title: Send Reminder follow ups when due date approaches in Excel using VBA
body: <p>I got an requirement where follow ups to be made automated through excel and reminder emails need to be send via VBA scripts . I got all the information, but sending automated email by clicking on the command button in the excel workbook throws me an error. Kindly help me in this</p>
  
  <pre><code>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(13))
  If MailDest = "" And Cells(iCounter, 13).Offset(0, -1) = "Send Reminder" Then
  MailDest = Cells(iCounter, 13).Value
  ElseIf MailDest &lt;&gt; "" And Cells(iCounter, 13).Offset(0, -1) = "Send Reminder" Then
  MailDest = MailDest &amp; ";" &amp; Cells(iCounter, 13).Value
  End If
  Next iCounter
  
  .BCC = MailDest
  .Subject = "Due date approaching"
  .Body = "Reminder: Your due date is near approaching . Please ignore if already paid."
  .Send
  End With
  
  Set OutLookMailItem = Nothing
  Set OutLookApp = Nothing
  End Sub
  </code></pre>
  
  <p>I have modified my script as this </p>
  
  <pre><code>Sub datesexcelvba()
  Dim myApp, mymail
  Dim mydate1 As Date
  Dim mydate2 As Long
  Dim datetoday1 As Date
  Dim datetoday2 As Long
  
  Dim x As Long
  lastrow = Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
  For x = 2 To lastrow
  
  mydate1 = Cells(x, 6).Value
  mydate2 = mydate1
  
  Cells(x, 9).Value = mydate2
  
  datetoday1 = Date
  datetoday2 = datetoday1
  
  Cells(x, 10).Value = datetoday2
  
  If mydate2 - datetoday2 = 3 Then
  
  Set myApp = CreateObject(Outlook.Application)
  Set mymail = myApp.CreateItem(olMailItem)
  mymail.To = Cells(x, 5).Value
  
  With mymail
  .Subject = "Payment Reminder"
  .Body = "Your credit card payment is due." &amp; vbCrLf &amp; "Kindly ignore if already paid." &amp; vbCrLf &amp; "Dinesh Takyar"
  .Display
  ‘.Send
  End With
  
  Cells(x, 7) = "Yes"
  Cells(x, 7).Interior.ColorIndex = 3
  Cells(x, 7).Font.ColorIndex = 2
  Cells(x, 7).Font.Bold = True
  Cells(x, 8).Value = mydate2 - datetoday2
  End If
  Next
  Set myApp = Nothing
  Set mymail = Nothing
  
  End Sub
  </code></pre>
  
  <p>It shows no error but since , i am unable to send emails. I have done this also in the VB Tools->References->Microsoft Outlook 12.0 object library is checked but it does not work. please help</p>