电子邮件通知在到期date

我想在有效期内通过电子邮件发送通知,此代码在到期前30天发送电子邮件

Sub reminder4() Dim lRow As Integer Dim i As Integer Dim toDate As Date Dim toList As String Dim eSubject As String Dim eBody As String Dim cList As String With Application .ScreenUpdating = False .EnableEvents = False .DisplayAlerts = False End With Sheets(2).Select lRow = Cells(Rows.Count, 4).End(xlUp).Row For i = 2 To lRow toDate = Replace(Cells(i, 3), ".", "/") If Left(Cells(i, 5), 4) <> "Mail" And toDate - Date <= 30 Then Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(0) Cells(i, 8) = "Mail Sent " & Date + Time 

它是发送电子邮件到期前30天我希望发送电子邮件到期。

replace这一行:

 If Left(Cells(i, 5), 4) <> "Mail" And toDate - Date <= 30 Then 

有:

 If Left(Cells(i, 5), 4) <> "Mail" And toDate <= Date Then