Excel 2003 interacting with another program
To activate another window you will need to use the following
AppActivate title where title is the tile of the window where the 2nd
program is running
To send keys strokes to another window use the following
expression.SendKeys(Keys, Wait)
See VBA help on how to use the functions.
"Steve" wrote:
I would like to program Excel 2003 to interact with a particular window in
another program. Essentially it would have to call the other window (already
open), send Alt-letter, tab or Enter command(s) to control its Menu, wait for
the program to change in response to the command(s), copy a string from Excel
and paste it in the other program, send Alt-letter, tab or Enter command(s)
to the program, wait for the other program to respond, send additional
Alt-letter, tab or Enter commands with short pauses in-between (one of which
is copy to clipboard), and finally return control to Excel, paste what was
copied to the clipboard by the other program, then loop to repeat with
another string from Excel and other data returned from the program.
Right now the Excel part is done with a macro, but while the other program
window is the focus it is all manual.
Is it possible to do this? The other program may have more than one window
open so how do I specify the particular window in am interacting with?
Depending on network traffic the speed of the other program's response may
vary (to respond to commands or to produce the data), so how can Excel sense
the changes that I would see as the other program responds, so it would know
when to send or do the next thing?
|