SendKeyStrokes Method
Activates the window at the given index in de WindowList and sends the keys specified to this Window.
When Key is an Integer, the value is not sent, but the method will wait the given amount of seconds before sending the next strings.
Syntax
ActiveWindowList.SendKeyStrokes( Index, Keys-1 [, Keys-2 [,...[, Keys-N]]] )
Parameters
Name | Type | Description |
---|---|---|
ActiveWindowList | The name of an object of type ActiveWindowList | |
Index | Long | Required. a value between 1 and the value of the Count attribute. |
Keys | Variant | Required. Must be a String or an Integer. |
ActiveWindowListtag:ActiveWindowList
Remarks
- This method uses SendKeys to send the strings to the active window so take a look at the Access/VBA manual for description of special keys.
See also
- Sleep
Example
'
' Find first active Notepad application and change content
' into Hello World
'
Dim WindowList As New ActiveWindowList
Dim Index As Long
Index = WindowList.Find("*Notepad*")
If Index Then
' Modify the content of the Notepad window found:
' Ctrl + A : Select all
' {DELETE} : Delete selected text
' Add "Hello world!"
' wait 1 second
' {BACKSPACE} : Remove "!"
Call WindowList.SendKeyStrokes(Index, "^a{DELETE}", "Hello world!", 1, "{BACKSPACE}")
End If