Hi Gurus,
I am trying to automate an application (yeas, i am novice!). Baiscally i need to run a software called traned from excel. The software doesnt have a com interface.
So far i have managed to open the file using shellexecute and i want to use sendkeys to send the keystrokes to the application to run it. However in doing so i am facing the following problems;
1) application opens and goes in the background
2)sendkeys sends keystrokes to excel instead

In addition to above, i would really appreciate if any one could help me with the following;
1) once run is finished, terminate the application
2) control windows, so if i call the same application more than once i could switch between windows.
3) A better way to wait for the run to finish. I am using application.wait at the moment. but a better option is need due to variability in duration of runs.
4)terminate the process and shift focus back to excel

I have search many forums but can't seem to find the right answer.
Please help!!

here is my code (for running the application once);
please note im using windows XP and office 07. Thanks

HTML Code:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
 
Private Sub Open_TranedFile()

ShellExecute Application.hWnd, "open", "C:\Documents and Settings\naziz.EGR\Desktop\a.tnd", vbNullString, vbNullString, 2

'Wait for application to load
Application.Wait Now + TimeValue("00:00:10")


SendKeys "%"
SendKeys "{right}"
SendKeys "{right}"
SendKeys "{right}"
SendKeys "{right}"
SendKeys "{right}"
SendKeys "{right}"
SendKeys "{right}"
SendKeys "{right}"
SendKeys "{right}"
SendKeys "{down}"
SendKeys "~"

End Sub