Hello I a beginner using UFT to automate some test cases I am using VBA to code. I have a requirement to read a substring using some characters within a long string.
My code is below

Window("Warehouse Management.ws").Type micF5
Wait (2)
Window("Warehouse Management.ws").WinObject("Workstation ID:").Output CheckPoint("Workstation ID:_2")
L_Sline2 = DataTable.Value("G_Status_20",Global)
L_Status_20 = Instr(L_Sline2,"20 Print")
L_Status_20_Valid = mid(L_Sline2,L_Status_20,8)
Loop Until L_Status_20_Valid = "20 Print"

I have this within a DO until loop. I am getting an error on the line that is in bold Invalid argument error can any one help with this.....

Also how to loop only a certain number of times