The combination of the two macro's.
You may want to consider to check if the range "F2" contains a valid email address ....
gr,
Gerard
Sub SendEmail()
'Automatically creates an new email, populated with relevant data from the spreadsheet'
Dim OApp As Object, OMail As Object, signature As String
Dim iRet As Integer
Dim strPrompt As String
Dim strTitle As String
If Range("F2").Value = "" Then 'Value > " " will generate error measage if cell contains something
strPrompt = "'Name' cell must be populated for feedback email to be sent!" _
& vbNewLine
strTitle = "Attention!"
iRet = MsgBox(strPrompt, vbYes, strTitle)
If iRet = vbYes Then 'Doesn't do anything in the macro
End If '
Exit Sub
End If
Set OApp = CreateObject("Outlook.Application")
Set OMail = OApp.CreateItem(0)
With OMail
.Display
End With
With OMail
signature = OMail.body
.ReadReceiptRequested = True
.To = Range("F2")
.cc = Range("AC131") & ";" & Range("AC133")
.Importance = 2
.Subject = Range("F2") & "'s" & " " & Range("AC118") & " " & "Call" _
& " " & Range("AB118") & " " & "Coaching Feedback"
.body = "Hi" & " " & Range("P131") & vbNewLine & vbNewLine _
& "Here is the feedback from the call I have assessed for you today..." & vbNewLine & vbNewLine _
& "Date of Call:" & " " & Range("AB6") & vbNewLine _
& "Time of Call:" & " " & Format(Range("AB8"), "hh:mm:ss") & vbNewLine & vbNewLine _
& Range("O63") & vbNewLine & vbNewLine _
& "If you have any questions regarding the above, or would like to discuss anything further, please let me know." & vbNewLine & vbNewLine _
& "Regards," & vbNewLine & vbNewLine _
& Range("W131") & signature
.Display
End With
Set OMail = Nothing
Set OApp = Nothing
End Sub
Bookmarks