Other applications and Sendkey [Two Questions]

steve case

Well-known Member
Joined
Apr 10, 2002
Messages
815
So far, i've gotten the following code:

SendKeys "%{tab}^a^c%{tab}"

to do my bidding and open another window, grab the contents and come back to Excel with it on the clipboard. It's a bit "clunky" for two reasons:

1. That code only seems to run by itself. if I put code before or after, it fails. If I try to call it up from another macro it fails )-:

2. I need to tell the users to make sure the target application is one [Alt-Tab] keystroke away.

I'm hoping someone here can help me with #2 above. Is there VBA code to activate a non-Excel window? For example, MyFile - Notepad or maybe XYZ-123 - InventoryControl or even MyPage - Microsoft Internet Explorer.

Any ideas on incorporating the Sendkey commands into more extensive codes would also be greatly appreciated.

It's pretty obvious what I'm trying to do here, so if I'm reinventing the wheel and Excel has as a "turn key" function, I really would like to know about it. (-:
.
.
.
.
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

steve case

Well-known Member
Joined
Apr 10, 2002
Messages
815
After a little search I found this:

http://www.mrexcel.com/board2/viewtopic.php?t=86074&highlight=sendkeys+appactivate

and a tour through VBA Help turns up:

Remarks

The AppActivate statement changes the focus to the named application or window but does not affect whether it is maximized or minimized. Focus moves from the activated application window when the user takes some action to change the focus or close the window. Use the Shell function to start an application and set the window style.

In determining which application to activate, title is compared to the title string of each running application. If there is no exact match, any application whose title string begins with title is activated. If there is more than one instance of the application named by title, one instance is arbitrarily activated.

*********************************

Now I expect I'll need help with sytax and figuring out what the "title String" is of the target applications.

That will wait until Monday
 

Forum statistics

Threads
1,147,845
Messages
5,743,513
Members
423,801
Latest member
paulj4177

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top