CitectVBA Programming Reference > CitectVBA Function Reference > Miscellaneous Functions > SendKeys


Sends one or more keystrokes to the active window of the active application as if they had been entered at the keyboard.

The value of the Wait argument determines when the SendKeys function completes and returns control to CitectVBA. If omitted, Wait is treated as FALSE by default.

Note:You can't use SendKeys to send keystrokes to an application that is not designed to run in Microsoft Windows. Sendkeys also can't send the PRINT SCREEN key {PRTSC} to any application..


SendKeys(keys, wait)


The string that is sent to the active window.


Enter TRUE or FALSE.

If wait is true the keystrokes must be processed before control is returned to the calling procedure. This argument is optional. If you omit it, it is assumed to be false.

Return Value



Dim intCounter As Integer		' Declare variables.
Dim dblProgID As Double, ' Launch Windows Calculator program.
dblProgID = Shell("Calc.exe", 1) ' Set up counting loop.
For intCounter = 1 To 5 ' Send keystrokes to Calculator
SendKeys intCounter & "{+}", True ' to add the value of intCounter each time
Next intCounter ' Return focus to Calculator.
AppActivate "Calculator" ' Send keystrokes toClose Calculator.

SendKeys "%{F4}", True