Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Plant SCADA

SendKeys

  • Last UpdatedJul 18, 2023
  • 1 minute read

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

Syntax

SendKeys(keys, wait)

keys:

The string that is sent to the active window.

wait:

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

None

Example

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

In This Topic
TitleResults for “How to create a CRG?”Also Available in