title: Error Catch if DoCmd.SendObject is terminated prematurely
body: <p>I have a email (SendObject) routine in MSAccess VBA. The code crashes if the user decides not to commit to hit the send button, and simply closes the email form.</p>
  <pre class="lang-vb prettyprint-override"><code>Private Sub ButtonSupportEmail_Click()
  
  Dim varName As Variant
  Dim varCC As Variant
  Dim varSubject As Variant
  Dim varBody As Variant
  
  varName = &quot;somebody@gmail.com&quot;
  varCC = &quot;somebody@gmail.com&quot;
  
  varSubject = &quot;ADB Front End Client Support_&quot; &amp; Now()
  varBody = &quot;Dear Amazing ADB Support Team:&quot;
  DoCmd.SendObject , , , varName, varCC, , varSubject, varBody, True, False
  
  End Sub
  </code></pre>
  <p>Is there an error catch I can add that prompts (via a popup form) the user &quot;No email sent&quot; and closes gracefully?</p>
  <p><strong>Fig A: Error from user closing Outlook Email Form</strong><br />
  <a href="https://i.stack.imgur.com/jjBmV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jjBmV.jpg" alt="enter image description here" /></a></p>