I was wondering how to send spacebar key
using SendKeys.send();
It works with the other keys but only the spacebar !!
Here is the link where I found the other keys http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.aspx
Asked
Active
Viewed 5.1k times
16

Sebastian Inones
- 1,561
- 1
- 19
- 32

seddik
- 219
- 2
- 5
- 12
4 Answers
38
Per the documentation you linked, SendKeys.send(" ");
will send a space key.
The only keys which require special codes are "characters that aren't displayed when you press a key".

hemp
- 5,602
- 29
- 43
0
A normal space with double quotes works SendKeys.SendWait(" ")
...but if you are sending characters as Char
instead of String
as the arguments make sure to replace the Char
space with a String
space.
if (chr == ' ')
{
SendKeys.SendWait(" ");
}else{
SendKeys.SendWait("{"+chr+"}");
}

Peter Csala
- 17,736
- 16
- 35
- 75

Keith Hair
- 11
- 1
0
From VBScript on Windows, you can open the system menu of the active window like this (the forum proposes 4 languages to be put as title, js was the nearest) :
oShell.SendKeys "%{ }", true
oShell.SendKeys "~", true

user3500176
- 29
- 2
-8
Use application.sendkeys "{SPACE}"

RAMESH
- 1
-
2`"{SPACE}"` is not one of the keywords for the `SendKeys.SendWait()` method. – Ellis Jan 18 '17 at 20:55