The second If Statement is completely ignored when this runs in refection. I have tried it several different ways. I want to keep the code as simple as possible because it will be modified in the future by end users.
Sub Test()
On Error GoTo ErrorHandler
Const NEVER_TIME_OUT = 0
Dim CR As String ' Chr(rcCR) = Chr(13) = Control-M
Dim yArray(3)
CR = Chr(Reflection2.ControlCodes.rcCR)
yArray(0) = "A!A"
yArray(1) = "B!B"
yArray(2) = "C!C"
yArray(3) = "D!D"
With Session
For i = 0 To 3
If .WaitForString("Enter:", NEVER_TIME_OUT, rcAllowKeystrokes) Then
.Transmit yArray(i)
.Transmit CR
End If
If .WaitForString(" ...OK? Yes//", NEVER_TIME_OUT, rcAllowKeystrokes) Then
Retest
End If
Next
End With
Exit Sub
ErrorHandler:
Session.MsgBox Err.description, vbExclamation + vbOKOnly
End Sub
Sub Test()
On Error GoTo ErrorHandler
Const NEVER_TIME_OUT = 0
Dim CR As String ' Chr(rcCR) = Chr(13) = Control-M
Dim yArray(3)
CR = Chr(Reflection2.ControlCodes.rcCR)
yArray(0) = "A!A"
yArray(1) = "B!B"
yArray(2) = "C!C"
yArray(3) = "D!D"
With Session
For i = 0 To 3
If .WaitForString("Enter:", NEVER_TIME_OUT, rcAllowKeystrokes) Then
.Transmit yArray(i)
.Transmit CR
End If
If .WaitForString(" ...OK? Yes//", NEVER_TIME_OUT, rcAllowKeystrokes) Then
Retest
End If
Next
End With
Exit Sub
ErrorHandler:
Session.MsgBox Err.description, vbExclamation + vbOKOnly
End Sub