I am having a problem when trying to automate an email. The outlook security msg pops up and if I click yes everything is ok.
However, if I click "NO" then I get runtime error 287. Any assistance would be appreciated. Below is a copy of my code.
Private Sub Text102_AfterUpdate()
Dim mess_body As String
Dim appOutLook As Outlook.Application
Dim MailOutLook As Outlook.MailItem
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
Dim strReqEmail As String
strReqEmail = (DLookup("[chrEmailAddress]", "tblRequestors", "[chrRequestorName] = [Forms]![frmSCMRTRequest]![Requestor Name]"))
Set appOutLook = CreateObject("Outlook.Application")
Set MailOutLook = appOutLook.CreateItem(olMailItem)
With MailOutLook
.BodyFormat = olFormatRichText
.To = strReqEmail
.Subject = "Request " & [Forms]![frmSCMRTRequest]!RQST_NBR & " has been assigned " & Me.Text102
.HTMLBody = "Your request has been assigned " & Me.Text102 & " and is continuing through the process" & _
" and you will be notified if there is any delay."
'.DeleteAfterSubmit = True 'This would let Outlook send the note without storing
.Send
End With
'MsgBox MailOutLook.Body
End Sub