Originally Posted by
zotja
found a solution for this integer loop inside string...
Dim Counter As String
Dim i As Integer
Dim wnd As String
Dim endd As String
For i = 6 To 8
wnd = "wnd[0]/usr/lbl[1,"
endd = "]"
Counter = wnd & i & endd
session.findById(Counter).SetFocus
session.findById(Counter).caretPosition = 0
session.findById("wnd[0]").sendVKey 2
Next i
thank you for your effort
you can simplify it to:
Dim Counter As String
Dim i As Integer
For i = 6 To 8
Counter = "wnd[0]/usr/lbl[1," & i & "]"
session.findById(Counter).SetFocus
session.findById(Counter).caretPosition = 0
session.findById("wnd[0]").sendVKey 2
Next i
And this should also work:
With session
For i = 6 To 8
With .findById("wnd[0]/usr/lbl[1," & i & "]")
.SetFocus
.caretPosition = 0
End With
.findById("wnd[0]").sendVKey 2
Next i
End With