![]() |
Sendkeys in Visual Basic
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 |
Sendkeys in Visual Basic
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. -- Gary''s Student - gsnu200730 "Zakynthos" wrote: 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 |
Sendkeys in Visual Basic
Many thanks for your help, I'll give it a go.
"Gary''s Student" wrote: 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. -- Gary''s Student - gsnu200730 "Zakynthos" wrote: 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 |
Sendkeys in Visual Basic
Update this post if you need more help
-- Gary''s Student - gsnu200730 "Zakynthos" wrote: Many thanks for your help, I'll give it a go. "Gary''s Student" wrote: 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. -- Gary''s Student - gsnu200730 "Zakynthos" wrote: 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 |
All times are GMT +1. The time now is 04:58 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com