I have seen previous threads regarding this but I am still struggling with it.
Can somebody please tell me where I need to put the code below, and also, do I need the Excel spreadsheet open at the time for the Reminder to be sent?
Sub CreateTasks()
Dim olApp As Object
Dim olTask As Object
Dim LastRow As Long
Dim i As Long
Set olApp = CreateObject("Outlook.Application")
LastRow = Cells(Rows.Count, "C").End(xlUp).Row
For i = 2 To LastRow
If Cells(i, "C").Value <> "" Then
Set olTask = olApp.CreateItem(3) 'olTaskItem
With olTask
.Subject = "Invoice - " & Cells(i, "B").Value
.Body = "Reminder for Maturity in " & Cells(i, "B").Value & "."
.Status = 1 'olTaskInProgress
.Importance = 2 'olImportanceHigh
.DueDate = Cells(i, "C").Value
.ReminderSet = True
.ReminderTime = Cells(i, "C").Value + TimeValue("08:45:00")
.Save
End With
End If
Next i
End Sub
Bookmarks