Sendkeys in Visual Basic

Z

Zakynthos

How do I place a 'pause' using sendkeys?

My problem is this - I need to copy a frame containing data from a web page
and paste it into a particular worksheet in Excel then return to the start
worksheet to begin the routine again.

Sendkeys works fine up to the point of pasting, but the code executes in an
order different from the order in which it was written and returns to the
start sheet and executes before the paste - so the table is incorrectly
pasted into the start sheet.

I've tried 'slowing' the routine down by adding some 'go to's' and sendkeys
"{TABS}" after the paste but it makes no difference - the code still executes
in the wrong order.

Many thanks
 
G

Gary''s Student

This is a "very" common problem with SendKeys. It's not a metter of slowing
down the VBA, it's a matter of letting the universe respond to the keystrokes.

After a block of SendKeys, issue a:

DoEvents

before moving on.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top