Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HowTo, for each request I make to attachmate save more than 1 line of information?

Status
Not open for further replies.

thxred

Technical User
Jun 14, 2019
1
PT


Hello everyone,

I'm new to tek-tips, and VBA.
I hope to contribute in the future with some useful information. At this moment I need your precious help.

So far I have been able to extract information from attachMate based on column A (Excel) and save the result to column B(row). The method I have used assumes that for each request I get 1 back. But now I face another challenge and I do not know how to make 1 request and receive 2,3,4,5,.. information lines back to column B(row). And what I find more difficult is to detect if there is more than 1 line of results and copying them to the column B(row).

Code:
Sub fetchNP()

Set Sys = CreateObject("EXTRA.System") ' Utilizar a sessao activa Extra X-treme
Set sess = Sys.ActiveSession
Set sess = sess.screen

Dim LastRow As Long
Dim CellData As String
Dim WS1 As Worksheet
Set WS1 = Worksheets(1)

LastRow = Range("A" & Rows.Count).End(xlUp).Row

For i = 1 To LastRow

CellData = (WS1.Cells(i, 1).Value)

sess.SendKeys "<clear>"
sess.SendKeys "XI00"
sess.SendKeys "<ENTER>"
sess.WaitHostQuiet (0)
sess.putstring "DX.55.60.05", 23, 2, 11
sess.SendKeys "<ENTER>"
sess.SendKeys "<ENTER>"
sess.WaitHostQuiet (0)
sess.putstring CellData, 4, 20, 17
sess.putstring "12.06.2019", 4, 53, 10
sess.WaitHostQuiet (0)
sess.SendKeys "<ENTER>"
sess.WaitHostQuiet (0)

If Not sess.getstring(24, 14, 11) = "Seleccionar" Then
MsgBox "number plate error " & CellData
GoTo endM
End If

WS1.Cells(i, "B").Value = sess.getstring(9, 35, 17)

'Possible information in sess.getstring(10, 35, 17)
'Possible information in sess.getstring(11, 35, 17)
'Possible information in sess.getstring(12, 35, 17)
'And so on......

next i

endM:

End Sub
 
Hi,

If it is possible that your inquiry will yield a multi-line result, then your results should reside on separate sheet/table where your column A value will be repeated for each column B result.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top