By Rawrplus

2019-03-08 14:55:28 8 Comments

bit of a stupid question, but I couldn't find any answers to it.
Sadly, I made a very shameful error, where I created an endless loop by accident.

Private Sub Textbox1_Change()
    Do While Len(Trim(Textbox1.Text)) > 4
       MsgBox "Please enter your birthyear in format of ####"
End Sub

As I wanted to enforce users to type only 4 digits, obviously not realising I made an given it's impossible to close the MsgBox as once you reach >4 characters, it keeps on creating new MsgBoxes even after you QueryClose/OK the one that popped up.

enter image description here

Is there a way I could cancel it, without closing Excel altogether? Sadly, I can't even pause the code given the MsgBox opened in modal form and I can't click any of the editor elements.

enter image description here


@Pspl 2019-03-08 14:58:33

Just press Ctrl + Alt + Pause/Break.

This will interrupt your routine.

The Pause/Break button is standardly located above the PageUp button on most keyboards

Related Questions

Sponsored Content

35 Answered Questions

[SOLVED] How do I debug Node.js applications?

2 Answered Questions

[SOLVED] Excel VBA - exit for loop

7 Answered Questions

[SOLVED] How to use Regular Expressions (Regex) in Microsoft Excel both in-cell and loops

42 Answered Questions

[SOLVED] How to create Excel (.XLS and .XLSX) file in C# without installing Ms Office?

  • 2008-09-29 22:30:28
  • mistrmark
  • 997281 View
  • 1729 Score
  • 42 Answer
  • Tags:   c# .net excel file-io

22 Answered Questions

[SOLVED] Is there a way to crack the password on an Excel VBA Project?

  • 2009-06-22 10:37:13
  • Jonathan Sayce
  • 1003851 View
  • 434 Score
  • 22 Answer
  • Tags:   excel vba passwords

13 Answered Questions

[SOLVED] How to avoid using Select in Excel VBA

  • 2012-05-23 05:57:58
  • 234594 View
  • 473 Score
  • 13 Answer
  • Tags:   excel vba

6 Answered Questions

[SOLVED] Loop through files in a folder using VBA?

2 Answered Questions

[SOLVED] Where does VBA Debug.Print log to?

  • 2010-05-26 19:54:28
  • l--''''''---------''''''''''''
  • 349744 View
  • 262 Score
  • 2 Answer
  • Tags:   vba debugging ms-office

15 Answered Questions

[SOLVED] Infinite loops in Java

Sponsored Content