×
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

waitforcursor works but only in debug mode

waitforcursor works but only in debug mode

waitforcursor works but only in debug mode

(OP)
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:)

RE: waitforcursor works but only in debug mode

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

Quote:

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

I think that you may have some problems!

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: waitforcursor works but only in debug mode

(OP)
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.

RE: waitforcursor works but only in debug mode

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,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: waitforcursor works but only in debug mode

CODE

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

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

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: waitforcursor works but only in debug mode

(OP)
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!

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