SendKeys function
SendKeys( Keys, [wait] )
Sends one or more keystrokes to the active window as if they had been entered at the keyboard.
The SendKeys statement has two parameters:
keys
A string sent to the active window.
wait
Optional parameter. If omitted, it is assumed to be false. If wait is true the keystrokes must be processed before control is returned to the calling procedure.
Example
Sub Main()
   Dim I, X, Msg   ' Declare variables.
   X = Shell("Calc.exe", 1)   ' Shell Calculator.
   For I = 1 To 5   ' Set up counting loop.
      SendKeys I & "{+}", True   ' Send keystrokes to Calculator
   Next I     ' to add each value of I.
   AppActivate "Calculator"   ' Return focus to Calculator.
   SendKeys "%{F4}", True   ' Alt+F4 to close Calculator.
End Sub