gpt4 book ai didi

excel - 如何在 VBA/VB.NET 中逃脱无限循环

转载 作者:行者123 更新时间:2023-12-04 21:14:23 24 4
gpt4 key购买 nike

有点愚蠢的问题,但我找不到任何答案。
可悲的是,我犯了一个非常可耻的错误,我不小心创建了一个无限循环。

Private Sub Textbox1_Change()
Do While Len(Trim(Textbox1.Text)) > 4
MsgBox "Please enter your birthyear in format of ####"
Loop
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

有没有办法可以取消它,而无需完全关闭 Excel?可悲的是,我什至无法暂停给定 MsgBox 的代码。以模态形式打开,我无法单击任何编辑器元素。

enter image description here

最佳答案

只需按 Ctrl + Alt + 暂停/中断。

这会打断你的日常生活。

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

关于excel - 如何在 VBA/VB.NET 中逃脱无限循环,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55065745/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com