I'm basically writing a macro to send emails to people when their tasks are overdue. I'm getting multiple problems with this. I have wrote the following code:


Sub OverdueProject()

Dim row_number As Integer
Dim Overdue As String
Dim x As Long
Dim mydate1 As Date
Dim mydate2 As Long
Dim lastrow As Long

lastrow = Sheet1.Cells.SpecialCells(xlCellTypeLastCell).Row

For x = 8 To lastrow

mydate1 = Cells(x, 9)
mydate2 = mydate1

Dim olApp As Outlook.Application
Dim olMail As Outlook.MailItem


If mydate2 <= Date And Sheet1.Cells(x, 11) = "" And (Sheet1.Cells(x, 15) = "" Or (Sheet1.Cells(x, 15).Value + 7 <= Date)) Then

Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.CreateItem(olMailItem)
    
    olMail.To = Cells(x, 13)
    olMail.Subject = "Overdue: " + " " + Cells(x, 1) + " " + "-" + " " + Cells(x, 2)
    olMail.Body = ("Dear " + Cells(x, 14)) & Chr(10) & "" & Chr(10) & ("Your task is: " + Cells(x, 12) + ".") & Chr(10) & ("Here is the link to the action spreadsheet: *spreadsheet link will be inserted here*") & Chr(10) & "" & Chr(10) & ("Kind Regards") & Chr(10) & "" & Chr(10) & ("drexcel7")
    olMail.Send

Sheet1.Cells(x, 15).Value = Date

End If
Next

End Sub
The email looks at the email in column 13 and sends an email to them based on the conditions wrote in the code. I have set it up so that it runs whenever the spreadsheet opens. The macro DOES do what it is intended, however, I get an error on the line "olMail.Send" saying "run-time error '2147467259 (80004005): we need to know who to send this to. Make sure you enter at least one name."

Is there any reason for this? Whilst it does do what I need to as is, I don't like the error that's popping up, and may cause others to panic should they use this spreadsheet.