PeterErhard
asked on
Exit While Does't work
Can anyone see why the below won't work?
I get a compile error on "Exit While" saying "Expected: Do or For or Sub or Function or Property"
I get a compile error on "Exit While" saying "Expected: Do or For or Sub or Function or Property"
While WebBrowser2.ReadyState <> READYSTATE_COMPLETE
DoEvents
WebCount = WebCount + 1
If Len(WebCount) > 9 Then
Exit While
End If
Wend
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
A beeter way to code it would be as shown below.
While WebBrowser2.ReadyState <> READYSTATE_COMPLETE _
and len(Webcount) > 9
DoEvents
WebCount = WebCount + 1
Wend
Oops that should read as follows:
While WebBrowser2.ReadyState <> READYSTATE_COMPLETE _
and len(Webcount) < 9
DoEvents
WebCount = WebCount + 1
Wend
That final solution I gave avoids "spaghetti" coding which is totally "frowned upon" by most programmers (and FOBIDDEN in educational institutions). You should never use the "Exit" statement if you want to maintain good programming standards.
ASKER