By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,256 Members | 1,548 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,256 IT Pros & Developers. It's quick & easy.

Trying to set up a Macro that will keystroke "alt + tab" keys

toddinator
P: 3
Here's the situation....

I have a Word doc open and an Excel workbook open. I can easily toggle between the 2 open files by pressing Alt&tab. What I'd like to do is to set up a macro in Word to copy some text , then toggle to my open excel workbook and paste it after I do a "cntl+F". Eventually there will be quite a bit more to this macro, but I'd like to start here. Can anyone help?
Aug 18 '07 #1
Share this Question
Share on Google+
4 Replies


Expert 5K+
P: 8,434
... set up a macro in Word to copy some text , then toggle to my open excel workbook and paste it ...
Look up SendKeys in the VB/VBA doco.
Aug 20 '07 #2

toddinator
P: 3
Look up SendKeys in the VB/VBA doco.
Thanks for the answer back. I've done that, and it works quite well. As I add more code to this macro though, it doesn't really like the fact that I start in MS Word and go to Excel. Once I toggle with the SendKeys "%{TAB}" function, how do I then make the Excel Workbook the active file? I've been told that SendKeys is a poor way to automate code. Any other suggestions?
Aug 20 '07 #3

Expert 5K+
P: 8,434
Thanks for the answer back. I've done that, and it works quite well. As I add more code to this macro though, it doesn't really like the fact that I start in MS Word and go to Excel. Once I toggle with the SendKeys "%{TAB}" function, how do I then make the Excel Workbook the active file? I've been told that SendKeys is a poor way to automate code. Any other suggestions?
Oh, definitely! SendKeys is very much a "quick and dirty" way to drive another application. If you can use automation to do the job, it'll be much more reliable.

I'm a bit rusty on how, but try doing some searching on a mixture of terms like VB and Excel and automation here at TheScripts, you should find quite a bit of information.
Aug 21 '07 #4

toddinator
P: 3
okay, I appreciate the help!
Aug 21 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.