Example:

  1. Sub Main ()

    1. Dim I, X, Msg' Declare variables.

      X = Shell("Calc.exe", 1)' Shell Calculator.

      For I = 1 To 5' Set up counting loop.

      1. 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