Not moving onto next cell?
Not moving onto next cell?
(OP)
I think I'm missing something very small. This is a rather simple macro (so far) that I am building onto. The problem that I am having is that "Putstring" (highlighted below) is not putting the next row into attachmate after it completes the first loop.
CODE --> VBA
Dim xlApp As Object, xlSheet As Object, MyRange As Object
Set xlApp = CreateObject("excel.application")
xlApp.Application.DisplayAlerts = False 'Turn off Warning Messages'
xlApp.Visible = True
xlApp.Workbooks.Open FileName:="C:\Users/Macros/OrderTracking.xlsx"
Set xlSheet = xlApp.ActiveSheet
Set myRange = xlApp.ActiveSheet.Range("A:A")
Dim Row As Long
With xlApp.ActiveSheet
Set myRange = .Range("A2:A2000").Resize(xlApp.CountA(.Range("A2:A2000")))
End With
For Row = 1 To myRange.Rows.Count
Sess0.Screen.Moveto 24,08
Sess0.Screen.Sendkeys("ortk<Tab>o")
Sess0.Screen.PutString myRange.Rows(Row).Value, 24, 28
Sess0.Screen.Sendkeys("<Enter>")
Do Until Sess0.Screen.WaitForCursor (24,08)
DoEvents
Loop
XlSheet.cells(myrange.row+row-1, "B").value = Sess0.Screen.GetString(15,28,1)
XlSheet.cells(myrange.row+row-1, "C").value = Sess0.Screen.GetString(12,68,5)
XlSheet.cells(myrange.row+row-1, "D").value = Sess0.Screen.GetString(11,68,10)
If (Sess0.Screen.GetString(15,28,1) = "s") or (Sess0.Screen.GetString(15,28,1) = "r") or (Sess0.Screen.GetString(15,28,1) = "e") or (Sess0.Screen.GetString(15,28,1) = "d") Then
XlSheet.cells(myrange.row+row-1, "E").putstring = ("REJECTED / SUSPENDED")
End if
Sess0.Screen.Sendkeys("<Pf10>")
Next Row
xlApp.Quit
Set xlApp = Nothing
System.TimeoutValue = OldSystemTimeout
End Sub
RE: Not moving onto next cell?
So what's actually happening? Please explain exactly.
So what's your objective with that statement?
RE: Not moving onto next cell?
Objective: This is supposed to send the numbers in column A into Attachmate, run a command, then return the text from three areas of the screen into columns B, C, then D. Then it should move onto the next column.
Problem: It continually moves the number in cell a2 into Attachmate, instead of moving from a2 to a3 to a4 and so on. It does however successfully move the text from the three desired areas from Attachmate into Excel and those are put in the correct areas. (row 2, then 3, then 4).
Also, for now, ignore the below lines. They may or may not work, I just tossed them in as a note more than anything
CODE -->
RE: Not moving onto next cell?
I figured it out. It seems I was rushing the macro and not waiting for the system to be ready! I added in a "WaitForCursor" and I'm golden!!!!
ha!
Thanks yet again Skip for all your help over the last few months!!!
RE: Not moving onto next cell?