jimmisavage
Board Regular
- Joined
- Jun 28, 2017
- Messages
- 130
Hi,
I hope someone can help. I run a vba which sends email reminders when a date is approaching. This used to work a dream in Excel 2007 but work have upgraded to 2013 and now the VBA stops in it's tracks - It seems to highlight the word 'Date' on the IF statement:
If sDate <= Date - 14 Then
Ws.Cells(i, 5).ClearContents
Ws.Cells(i, 8).ClearContents
End If
The error is: Compile error: Can't find project or library
I hope someone can help. I run a vba which sends email reminders when a date is approaching. This used to work a dream in Excel 2007 but work have upgraded to 2013 and now the VBA stops in it's tracks - It seems to highlight the word 'Date' on the IF statement:
If sDate <= Date - 14 Then
Ws.Cells(i, 5).ClearContents
Ws.Cells(i, 8).ClearContents
End If
The error is: Compile error: Can't find project or library
VBA Code:
ActiveWorkbook.Sheets("Home").Activate
Dim lRow As Integer
Dim i As Integer
Dim toDate As Date
Dim toList As String
Dim eSubject As String
Dim eBody As String
With Application
.ScreenUpdating = False
.EnableEvents = False
.DisplayAlerts = False
End With
Sheets("mailpage").Visible = True
Sheets("mailpage").Select
Dim Ws As Worksheet
Dim LR As Long
Dim sDate As Date, fDate As Date
Application.ScreenUpdating = False
Set Ws = Worksheets("mailpage")
LR = Ws.Range("H" & Rows.Count).End(xlUp).Row
For i = LR To 2 Step -1
sDate = Ws.Cells(i, 8).Value
If sDate <= Date - 14 Then
Ws.Cells(i, 5).ClearContents
Ws.Cells(i, 8).ClearContents
End If
Next i
Application.ScreenUpdating = True