Hi bighalo,
As far as solving the problem of unexpected results ...
You've only provided a snippet of code and so I really do not have context for the issue, but isn't it conceivable
nIndex might ever
not be equal to 1?
If that's the case,
exit sub is not going to get called (at least in that loop).
You might temporarily add
MsgBox statements in the code at strategic points to try to verify the data:
Code:
sub main()
MsgBox "Entering Main()"
...
do
nIndex = objTab.Screen.WaitForStrings(g_vWaitFors)
MsgBox "nIndex: " & nIndex
if nIndex = 1 then
...
<do something>
MsgBox "About to exit Main() subroutine"
exit sub
end if
loop
end sub