gpt4 book ai didi

vba - 在 VBS/VBA 中退出 while 循环

转载 作者:行者123 更新时间:2023-12-02 07:53:44 27 4
gpt4 key购买 nike

VBS/VBA 中有退出/中断 while 的方法吗?

以下代码将无法按预期工作:

num = 0
while (num < 10)

if (status = "Fail") then
exit while
end if

num = num+1
wend

最佳答案

VBScript 的 While 循环不支持提前退出。使用 Do 循环来实现:

num = 0
do while (num < 10)
if (status = "Fail") then exit do
num = num + 1
loop

关于vba - 在 VBS/VBA 中退出 while 循环,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1271949/

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