Jose Campa
Member
- Outlook version
- Outlook 2016 64 bit
- Email Account
- Office 365 Exchange
I am trying to create a macro that will look in the subject line for the word [Encrypt]. If the word is anywhere in the subject then it just sends the email. But if it is not found, then it will prompt the user to ask them "You are sending an unencrypted message, are you sure you want to send this?". Below is what I have so far but it will prompt the user even though [Encrypt] is or isn't there.
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
On Error Resume Next
Dim strSubject As String
strSubject = Msg.Subject
If InStr(Msg.Subject, "[Encrypt]", vbTextCheck) > 0 Then
Prompt$ = "You sending this unencrypted. Are you sure you want to send it?"
If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Encryption Checker") = vbNo Then
objMsg.Send
Cancel = True
End If
End If
End Sub
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
On Error Resume Next
Dim strSubject As String
strSubject = Msg.Subject
If InStr(Msg.Subject, "[Encrypt]", vbTextCheck) > 0 Then
Prompt$ = "You sending this unencrypted. Are you sure you want to send it?"
If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Encryption Checker") = vbNo Then
objMsg.Send
Cancel = True
End If
End If
End Sub