Give a look.
I hope you find this useful. Bye bye.
'--------------------------------------------------------------------------------
' This macro was created by the Macro Recorder.
' Session Document: "monitoraggio erogazioni"
' Date: 14/12/2001
' User: barsotti
'
'--------------------------------------------------------------------------------
' Global variable declarations
Global g_HostSettleTime%
Global g_szPassword$
Sub Main()
'--------------------------------------------------------------------------------
' Get the main system object
Dim Sessions As Object
Dim System As Object
Set System = CreateObject("EXTRA.System"

' Gets the system object
If (System is Nothing) Then
Msgbox "Could not create the EXTRA System object. Stopping macro playback."
STOP
End If
Set Sessions = System.Sessions
If (Sessions is Nothing) Then
Msgbox "Could not create the Sessions collection object. Stopping macro playback."
STOP
End If
'--------------------------------------------------------------------------------
' Set the default wait timeout value
' RESET
g_HostSettleTime = 300 ' milliseconds
OldSystemTimeout& = System.TimeoutValue
If (g_HostSettleTime > OldSystemTimeout) Then
System.TimeoutValue = g_HostSettleTime
End If
' Get the necessary Session Object
Dim Sess0 As Object, MyScreen As Object
Set Sess0 = System.ActiveSession
Set MyScreen = Sess0.Screen
If (Sess0 is Nothing) Then
Msgbox "Could not create the Session object. Stopping macro playback."
STOP
End If
If Not Sess0.Visible Then Sess0.Visible = TRUE
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
'--------------------------------------------------------------------------
' Collegarsi a SIBE2000, Interrogazione Pratica di Fido/Interr.Situazione Pratica
'
Dim rc%, row%, MaxColumns%, MaxRows%, filenum%, spia%, vmax%, vv1%, fnum2%, nprat$
Dim Screenbuf$, linebuf$, FileName$, v1$, v2$
' Determine the size of the Presentation Space
MaxRows% = Sess0.Screen.Rows()
MaxColumns% = Sess0.Screen.Cols()
'look if the screen is the right one....
v1$ = MyScreen.GetString(3, 23, 14)
if v1$ <> "Interrogazione" then
'no -> error!!!
msgbox "Occhio: entrare nella maschera giusta per attivare la funzione!"
exit sub
end if
' Initialize variables to hold screen information
Screenbuf$ = ""
linebuf$ = Space$ (MaxColumns%)
close
' Get the next available file number
filenum% = FreeFile
FileName$ = "C:\documenti\monitndg.txt"
Open FileName$ For OUTPUT as filenum%
fnum2% = freefile
' this file contains is a group of keys I need to interrogate
Open "C:\documenti\ndgin.txt" for input as fnum2%
do
if MyScreen.GetString(3, 23, 14) <> "Interrogazione" then
'Isn't the right screen?!?
msgbox "Fine anomala"
exit do
end if
if Sess0.Screen.Row <> 10 or Sess0.Screen.Col <>35 then
'Prepare the request
Sess0.Screen.Sendkeys("<Home>"

Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
end if
input # fnum2%, nprat$
Sess0.Screen.Sendkeys("<Tab><Tab>" + nprat$ +"<Enter>"

Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Pf6>"

Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
if MyScreen.GetString(3, 22, 14) = "Interrogazione" then
'Error !!!
Sess0.Screen.Sendkeys("<Reset>"

Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Print # filenum%, nprat$ + "Pratica inesistente"
else
'Found data !!!
Sess0.Screen.Sendkeys("<Tab>"

Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
'Here I write data to a .txt file I will open with MSexcel
'It will find easily the data as fixed lenght strings
'You may, instead, use a character [like tab -chr$(9)] to separate the data
Print # filenum%,MyScreen.GetString(2, 45, 7);
Print # filenum%,MyScreen.GetString(4, 8, 37);
Print # filenum%,MyScreen.GetString(6, 22, 30);
do
for row% = 17 to 20
linebuf$ = MyScreen.GetString(row%, 9, 5)
if linebuf$ = " " then exit for
Print # filenum%, MyScreen.GetString(row%, 9, 26);
next
if linebuf$ = " " then exit do
if MyScreen.GetString(21, 74, 4) = "Fine" then exit do
Sess0.Screen.Sendkeys("<RollUp>"

Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
loop
Print # filenum%,""
end if
Sess0.Screen.Sendkeys("<Pf3>"

Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
loop until eof(fnum2%)
close
System.TimeoutValue = OldSystemTimeout
End Sub