Sendkeys is a command in VB that allows you to send keystrokes from your app to the currently active (foreground) application. For example, you can open a blank notepad document, and send something to it like so:
Shell "c:\windows\notepad.exe", vbNormalFocus
Me.Show
DoEvents
AppActivate ("Untitled - Notepad")
SendKeys "hello world"
The problem, is that you need the window to stay behind your application, and therefore, sendkeys will not work.
Now, you can TRY to use the windows API.... which has certain function calls that might help.... one of those function calls is "sendmessage" which allows your program to send a windows message (a hex number that windows understands to do something). Everything that happens to a window, mouse move, mouse down, mouse up is done by a windows message. One of the windows messages, is called "WM_SETTEXT", which has some hex value... pretty nifty huh, WM for windows message, and settext for what it does....
Now, we've just increased our power significantly from sending keystrokes, to sending any kind of message that windows can send....(just about, this isn't the C language, so we have no power in pointers [except addressof, but not really the same]). This leads us to a major problem.... it's all find and dandy, but we have to know the hWnd to send this information to. Every window (mind you, everything in windows is a window.... a textbox, a listbox, a window, a button, they are all a window) every window has an hWnd. An hWnd is a number windows randomly assigns to a window (any window) to identify it from other windows. So, you are going to have to try to find the hwnd, not of the program, but of the textbox on the program, that you want to set the text of. Now, there is a way to do this, but it requires a lot of work, and a lot of trial and error. You need to use the "findwindow" API, AND the FindwindowEx API. The reason, is because the hWnd of any window changes every time. It's never the same. Every time the program launches, windows craps out a new hWnd. Nice huh?
Now, things get complicated. Windows are hierachial, so, each "control" which is a window, actually has a "parent" window. Meaning that a textbox, combo-box, listbox, button, etc, are all children windows that are owned by their parent window. So, that means, you'll have to first get the hWnd of the parent window. (oh yeah, and this is assuming the textboxes or whatever aren't in a frame, or some other container control which behaves as the temporary foster parent.... meaning, you'd have to get the main window's hWnd, then the Frame's hWnd, THEN the textbox's hWnd). Now, if the window has more than 1 textbox, you'll have to do findwindowex in a loop (findwindow returns the hWnd of a top level window, findwindowEx returns the hWnd of a child window of the parent hWnd specified), and figure out which order they get returned to your program, so you know which one you need to use to send the WM_SETTEXT message to.
I've attached the code for using SendMessage with the WM_SETTEXT constant, and I've also attached a program that will get the hWnd of whatever window is beneath the mouse. This way, so you can see what I"m talking about with the settext. If you run GetClass, it will return a wealth of information about whatever window is beneath the mouse cursor... the hwnd, the class, the title, and the threadID. Then if you run the settext program, and place the cursor over a textbox (with getclass running) and get the hwnd, plug that into the settext program, and type something, and hit set.... it will set the text in the textbox of a different program......