You should be able to make the following change (see code in red):
Private Sub Workbook_Open()
Dim i As Long
Dim OutApp As Object
Dim OutMail As Object
Dim strto As String, strcc As String, strbcc As String
Dim strsub As String, strbody As String
For i = 4 To Sheets("Sheet1").Range("B65536").End(xlUp).Row
If Sheets("Sheet1").Cells(i, 2).Value = (Date + 30) Then
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
strto = Sheets("Sheet1").Cells(i, 3).Value
strcc = Sheets("Sheet1").Cells(i, 4).Value & _
"; " & Sheets("Sheet1").Cells(i, 5).Value
strbcc = ""
strsub = "Contract Expiry Notice"
strbody = "Hi there" & vbNewLine & vbNewLine & _
"Your contract, " & Sheets("Sheet1").Cells(i, 1).Value & _
", is due to expire on " & Sheets("Sheet1").Cells(i, 2).Value & _
". Please contact us at your earliest convenience." & _
vbCrLf & vbCrLf & "Thank you."
With OutMail
.To = strto
.CC = strcc
.BCC = strbcc
.Subject = strsub
.Body = strbody
.Send
End With
Set OutMail = Nothing
Set OutApp = Nothing
End If
Next i
End Sub
Semi-colons are typically valid as e-mail address separators, however if your default is something else (a comma, for example), change the semi-colon to that character.
Bookmarks