title: VB code for outlooks attachment to send secure
body: <p>I know nothing about VB.  I have the following code to have a reminder pop up if the word "attachment" is mentioned in the message body.  What I want is a reminder if the message includes an attachment and ask if the message should be sent securely (encrypted).</p>
  
  <pre><code>Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
  ‘ Pops up a reminder if the word “attach” is found but there is no attachment on your email.
  Dim m As Variant
  Dim strBody As String
  Dim intIn As Long
  Dim intAttachCount As Integer, intStandardAttachCount As Integer
  
  On Error GoTo handleError
  
  ‘Edit the following line if you have a signature on your email that includes images or other files. Make intStandardAttachCount equal the number of files in your signature.
  intStandardAttachCount = 0
  
  strBody = LCase(Item.Body)
  
  intIn = InStr(1, strBody, “original message”)
  
  If intIn = 0 Then intIn = Len(strBody)
  
  intIn = InStr(1, Left(strBody, intIn), “attachment”)
  
  intAttachCount = Item.Attachments.Count
  
  If intIn &gt; 0 And intAttachCount &lt;= intStandardAttachCount Then
  
  m = MsgBox(“It appears that you mean to send an attachment,” &amp; vbCrLf &amp; “but there is no attachment to this message.” &amp; vbCrLf &amp; vbCrLf &amp; “Do you still want to send?”, vbQuestion + vbYesNo + vbMsgBoxSetForeground)
  
  If m = vbNo Then Cancel = True
  
  End If
  
  handleError:
  
  If Err.Number &lt;&gt; 0 Then
  MsgBox “Outlook Attachment Reminder Error: ” &amp; Err.Description, vbExclamation, “Outlook Attachment Reminder Error”
  End If
  
  End Sub
  </code></pre>