Alex Rivera | Logout

Exit a while loop in VBS/VBA

Asked 2009-08-13T13:28:28.783
35

Is there a method of exiting/breaking a while in VBS/VBA?

Following code won't work as intended:

num = 0
while (num < 10)

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

    num = num+1
wend
Edit
Report

1 Answer

12

what about changing the while loop to a do while loop

and exit using

Exit Do
answered 2009-08-13T13:30:11.517

Your Answer