title: How to check for attachment when sending an email?
body: <p>I've come across macros that check whether any items are attached when you use the word 'attachment' (or any other word you desire) in your email, e.g. the following:</p>
  <pre class="lang-vb prettyprint-override"><code>Public Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
      Dim vList As Variant
      Dim answer As Integer
      Dim i As Integer
      
      vList = Array(&quot;attached&quot;, &quot;attachment&quot;)
      
      If Item.Attachments.Count = 0 Then
          For i = 0 To UBound(vList)
              If InStr(1, LCase(Item.Body), LCase(vList(i)), vbTextCompare) &gt; 0 Then
                  answer = MsgBox(&quot;There's no attachment, send anayway?&quot;, vbYesNo)
                  If answer = vbNo Then Cancel = True
                  Exit Sub
              End If
          Next i
      End If
      
  End Sub
  </code></pre>
  <p>I've only seen macros that check whether the <code>Item.Body</code> contains one of the specified words. When responding to an email, <code>Item.Body</code> is not just the new text, but also the previous text to which I am responding.<br />
  This is a problem, as many clients have the word 'attachment' in their disclaimer. As a result, I often get the warning that there is no attachment at unnecessary moments.</p>
  <p>I tried different properties of the <code>Item</code> object.</p>
  <p>It seems to me there is no way to select only the newest typed text.</p>