I'm trying to create a macro that puts a number into Extra at location 3,17 , enter is hit, the screen is displayed data. It then moves to location 5,13, pulls that field which is 10 characters long. And puts that field into excel in Column B, starting at Row 2 and going down. The original number that goes into Extra at location 3/17, is from the same excel sheet in Column A starting at row 2 and going down. Here is what I have.
Code:
Sub Main
Dim Sessions, System As Object, Sess0 As Object
Set System = CreateObject("EXTRA.System")
Set Sessions = System.Sessions
Set Sess0 = System.ActiveSession
file = "H:\Macros - Reports\Tests\Numbers.xls"
Dim obj as object
Dim objWorkbook as object
Set obj = CreateObject("Excel.Application")
obj.visible = True
obj.workbooks.open file
'---------------------------------
'assumption
'data begins in row 2
'----------------------------------
begrw = 2
col = 2
with obj.worksheets("Sheet1")
for x = begrw to endrw 'obj.ActiveSheet.Rows.Count
MyDat = .cells(x,1)
If MyDat = "" Then Exit Sub
'-----send data to Extra-------
Sess0.Screen.PutString MyDat,3,17 'area data goes into in extra
Sess0.Screen.Sendkeys("<enter>")
Sess0.Screen.MoveRelative 1, 1
'wait for response
Do
DoEvents
Loop Until Sess0.Screen.WaitForCursor(3,17)
'-----grab data from Attachmate-----
ExtraDat = Sess0.Screen.GetString (5,13,10) 'area getting data from
'-----and place data in Excel-------
.cells(x,col) = ExtraDat 'this places the information in the sheet
'----------------------------
next x
msgbox "Macro Done"
end with
End Sub