Code below extracts the data for the first account # that is in column A but does not continue the loop to goto next account #. Column A has the accounts numbers and column D would be the data that is extracted from mainframe into excel
Code:
Sub Extract()
Dim Sessions, System As Object, Sess0 As Object
Set System = CreateObject("EXTRA.System")
Set Sessions = System.Sessions
Set Sess0 = System.ActiveSession
With Worksheets("Template")
Row = 2
Do
Pull = .Cells(Row, "A").Value
Sess0.Screen.putstring Pull, 12, 43
Sess0.Screen.SendKeys ("<Enter>")
Sess0.Screen.WaitHostQuiet (100)
.Range("D1").Offset(1).Value = Trim(Sess0.Screen.GetString(7, 2, 25))
Sess0.Screen.SendKeys ("<Clear>")
Exit Do
Row = Row + 1
Loop Until .Cells(Row, "A").Value <> ""
End With
End Sub