title: Is there a way to go back to the error line and stop?
body: <p>So I am writing up a VBA code for error handling and i want it to send me an email when the Bot fails which is as below:</p>
  <pre><code>On Error GoTo x:
  
  'main code
  
   Exit Sub
  
       x:
          Set OutApp = CreateObject(&quot;Outlook.Application&quot;)
          Set OutMail = OutApp.CreateItem(0)
  
             With OutMail
              .To = &quot;hamza.ali@telus.com&quot;
              .Subject = &quot;Error Occured - Error Number &quot; &amp; Err.Number
              .Body = &quot;We have found an error with the bot. Please open the VM to debug the problem. --&gt;&quot; &amp; Err.Description &amp; &quot; And the reason is: &quot; &amp; Err.Source
  
              .Display '~~&gt; Change this to .Send for sending the email
            End With
          Debug.Print &quot;x -&quot; &amp; Err.Description &amp; Err.Source
          Set OutApp = Nothing: Set OutMail = Nothing
           End Sub
  </code></pre>
  <p>I want to have a way where I can send an email through this error handle method AND THEN go back to the error line and STOP. So that when i am trying to debug i know which line the error happened and can try to fix it instead of running the 100 line of code again to see where the error happened.</p>