Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

waitforcursor works but only in debug mode

Status
Not open for further replies.

newbie789

Programmer
Nov 9, 2015
6
US
In Excel, there are 100 records. The macro goes thru various screens to capture data, put into Excel, and post commands into Attachmate.
In one of the screens, the cursor is on 23, 7. I send a command F8 continuously until a message appears on line 24. F8 goes to the next record so the screen. Fields are the same as the last screen except for the data. If there is a message 'last record' on line 24, then it captures data on that screen and put it into the spreadsheet.

This works if I go thru each line in the code in Excel module in debug mode. But if I run it, it will do about 5 records.

Do until Sess0.screen.getstring(24,2,11)="last record")
Sess0.screen.SendKeys ("PF8")
Do Until .Screen.WaitForCursor(23, 7)
DoEvents
Loop
loop

Any help is appreciated:)
 
Hi,

Are you posting (COPY n PASTE) your ACTUAL code? Isn't it ...
Code:
Sess0.screen.SendKeys ("<PF8>")
???

Also, does your screen display lower case "last record"?

And where's the Sess0 object on that statement?

Makes me REALLY wonder.

What about...
But if I run it, it will do about 5 records.
...and then what happens?

I think that you may have some problems!



Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
oops...typo...
I have all the Sess0 object. I'm just posting the code where I think is the problem. It works fine if I change it to wait for 3 seconds instead of waiting for cursor, but I don't want to do that because it takes too long.

Do until Sess0.screen.getstring(24,2,11)="last record")

Sess0.screen.SendKeys ("<PF8>")
Do Until Sess0.Screen.WaitForCursor(23, 7)
DoEvents
Loop
loop


This screen has a lot of fields and data. When I press F8 manually, it goes to the next record with the same fields. So I can't use waitforstring or can I?..hmm. Cursor stays at 23,7.

First 5 records works fine. Sometimes it's first 10 records. It did not capture any data for the rest of the records.
 
Well, too many posted anomalies at this point. There's something that you're not revealing. You haven't answered all my questions. Hmmmmmmm?

I've used WaitForCursor with outstanding results for years.

Be sure to dot your Is and cross your Ts. Mind your Ps & Qs. Good luck!

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Code:
Do until Sess0.screen.getstring(24,2,11)="last record")
[b]
   Sess0.screen.MoveRelative 1, 1[/b]
   Sess0.screen.SendKeys ("<PF8>")
   
   Do Until Sess0.Screen.WaitForCursor(23, 7)
      DoEvents
   Loop
loop

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
That worked! But why? that's not where I want the cursor to be.
Is it because the cursor on the next screen is the same location as the previous screen?

You're awesome!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top