I tried to look all over the place for an answer, but I'm new to coding for my call center and really need some help. Here is what I'm trying to accomplish:

In Reflection, I am trying to search for a specific string within a set of rows. If the string is not on the first row, I want the cursor to move down to the next row and search for the string (repeating until the string is found on a row). Once the string is found, I want the cursor to select that row.

I have included my code which isn't working but hopefully will help:

-Sub gynbereferral()
-Const NEVER_TIME_OUT = 0

-Dim LF As String ' Chr(rcLF) = Chr(10) = Control-J
-Dim CR As String ' Chr(rcCR) = Chr(13) = Control-M
-Dim ESC As String ' Chr(rcESC) = Chr(27) = Control-[

-LF = Chr(Reflection2.ControlCodes.rcLF)
-CR = Chr(Reflection2.ControlCodes.rcCR)
-ESC = Chr(Reflection2.ControlCodes.rcESC)

-With Session
-Dim Reflection As Object
-Set Reflection = GetObject(, "Reflection2.Session")
-Dim LastColumn As Integer
-LastColumn = .DisplayColumns
-Dim cursorRow As Integer
-cursorRow = .cursorRow
-Dim screen_name As String
-screen_name = Reflection.GetText(0, 32, 0, 47)
-Dim ploc_name As String
-ploc_name = Reflection.GetText(cursorRow, 0, cursorRow, LastColumn)
-Dim Text As String
-Text = Reflection.GetText(cursorRow, 0, cursorRow, LastColumn)


-.Transmit "r" & CR
-.Transmit "m" & CR
-.Wait ("1")
-ploc_name = Reflection.GetText(cursorRow, 0, cursorRow, LastColumn)
-Do
-If ploc_name Like "*GYBEGP*" Then
-.TransmitTerminalKey rcVtSelectKey
-.Transmit CR
-.Transmit CR
-.Transmit CR
-.Transmit CR
-.Transmit CR
-.Transmit CR
-.Transmit CR
-.Transmit CR
-.Transmit CR
-.Transmit CR
-.Transmit CR
-.TransmitTerminalKey rcVtRemoveKey
-.Transmit "99"
-.TransmitTerminalKey rcVtEnterKey
-.TransmitTerminalKey rcVtRemoveKey
-.Transmit "ftr" & CR
-.Transmit CR
-.Transmit CR
-.Transmit "+90" & CR
-.Transmit CR
-.Transmit CR
-.Transmit CR
-.Transmit CR
-.Transmit CR
-.Transmit CR
-.Transmit CR
-.Transmit CR
-.Transmit CR
-.Transmit CR
-.Transmit CR
-.Transmit CR
-.Transmit CR
-.Transmit CR
-.Transmit CR
-.Transmit CR
-.StatusBar = "Waiting for Prompt: File changes and exit."
-.WaitForString ESC & "[KFile changes and exit.", NEVER_TIME_OUT, -rcAllowKeystrokes
-.StatusBar = ""
-.Transmit CR
-.StatusBar = "Waiting for Prompt: Print (L)ist, or (Q)uit:"
-.WaitForString LF & " Print (L)ist, or (Q)uit: ", NEVER_TIME_OUT, -rcAllowKeystrokes
-.StatusBar = ""
-.Transmit "b" & CR
-.TransmitTerminalKey rcVtSelectKey
-Else
-.TransmitTerminalKey rcVtDownKey
-ploc_name = Reflection.GetText(cursorRow, 0, cursorRow, LastColumn)
-Loop Until ploc_name Like "*GYBEGP*"
-Loop

-Do
-If ploc_name Like "*GYBEGP*" Then
-.TransmitTerminalKey rcVtSelectKey
-Else
-.Wait ("3")
-.TransmitTerminalKey rcVtDownKey
-.Wait ("3")
-ploc_name = Reflection.GetText(cursorRow, 0, cursorRow, LastColumn)
-Loop Until ploc_name Like "*GYBEGP*"
-Loop

Sometimes I can get my loop to work but it won't stop looping, like it it's looking for the GYBEGP string.

PLEASE HELP!!!