×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Not moving onto next cell?

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?

Hi,

So what's actually happening? Please explain exactly.

So what's your objective with that statement?

RE: Not moving onto next cell?

(OP)
Oh sorry! I thought I put that part in there.

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 -->

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 

RE: Not moving onto next cell?

(OP)
WAIT!!!

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?

WaitForCursor: perfect!😉

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close