473,756 Members | 6,028 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

toddinator
3 New Member
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
4 4048
Killer42
8,435 Recognized Expert Expert
... 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
3 New Member
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
Killer42
8,435 Recognized Expert Expert
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
3 New Member
okay, I appreciate the help!
Aug 21 '07 #5

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

Similar topics

8
10649
by: Lian | last post by:
Hi all, It is a newbie's question about html tag "img". The attributes "title" and "alt" for "img" seems having the same function. So what is the main difference between them? Can i use them at the same time and set different values? Thank you for suggestions!
1
2647
by: Dave McCloskey | last post by:
How can I convert the "Enter" key to a "Tab" so my application will act like "Tab" has been hit when the "Enter" key has actually been depressed. This gives type-writer functionality to programs. I was able to do this very simply in VB6, however, I have not found a method to do this in .NET. -- Take Care, Dave
3
2060
by: dencdr | last post by:
Hi, I have an application VB.NET (using Form Win32) with no icon in TaskBar. When a FORM of this application is visible I see this application in the list of "Alt+Tab" choice. How do for this application does not appear in this list when a FORM is visible ?
5
2896
by: Lars Netzel | last post by:
Hey! I have tried...(in a datagrid) e.KeyDate.Return and e.KeyDate.TAB end e.KeyDate.Enter
0
1098
by: Sven Franz | last post by:
I develop an MDI-Application in vb.net (2002). But I got som errors, I can`t handle. When I have opened some MDI-Children and also closed them, my application crashed when I switch to an other application with "ALT" + "TAB". The error-message: at System.Windows.Forms.UnsafeNativeMethods.PeekMessage(MSG& msg, IntPtr hwnd, Int32 msgMin, Int32 msgMax, Int32 remove) at...
7
5718
by: Doug Bell | last post by:
Hi, I have just built a small application with a form that has one Text Box and one Check Box and a couple of Command Buttons. What I am trying to achieve is that if the Text Box has focus and the User hits the "Enter" button the focus will move to the next Tab item (i.e. the Check Box). Likewise on the Check Box but obviously if a Command Button has the focus, it will initiate the Click event I have set the Forms CancelButton to the...
2
21267
by: Prabhudhas Peter | last post by:
How to Detect the "TAB" Key is pressed in the Text Box or Combo Box.... Which events catches the TAB key... I Want to perform some operations when the "TAB" key is pressed... -- Peter...
2
2297
by: _DD | last post by:
I'm trying to gracefully intercept Control and Alt keys for mouse events within a Panel. I realize that keyboard is not normally relevant there, but in this case, I need to get Ctrl-LeftMouseButton, etc. This could be intercepted by the form that owns the panel, but that does not seem very elegant. Are there any alternatives? I could use another type of base control if necessary. I'm mostly painting graphics.
3
8770
by: Eric Layman | last post by:
Hi everyone. An image allows alt attribute. When mouse over images with alt attribute, a small yellow popup would appear besides the mouse cursor. How to replicate this behaviour using a table cell instead? Is this even possible? Thanks.
0
9431
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9255
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9844
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9819
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9689
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8688
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6514
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5119
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5289
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.