More SendKeys VBA

Link to website for below:

http://cpap.com.br/orlando/SendKeysMore.asp

The below keys I didn't really test. I tested other keys with my userform which is far superior. I like to set a breakpoint in my vba code for each click loop and press F5 to do an iteration every second manually while running code like this to limit actions to minimal actions.

b INDEPENDENT SENDKEYS for Microsoft VBAWhat's new   Download   Home  
This utility is a tiny Microsoft® Windows® application of only one file, the SendKeys.exe, that can be executed with arguments in the command line to send keystrokes to other application window running on the Windows in an independent way (simulating multithreading in the calling code) with options to control the start, the throughout and the end of the sending.It’s interesting to be called from codes of any only one thread language like the Microsoft Visual Basic® for Application (VBA) in Microsof Office where built-in Sendkeys statement can’t offer an adequate control to be called from determined positions of a procedure. It’s also interesting to be called from the dialog box of Windows Run command, from Windows Shortcuts, and from scripts that haven’t SendKeys statement like command lines in Windows console (CMD batch file, DOS BAT).Following items in this page:FeaturesDownloadComplete Syntax of the String to SendExtra VBA Additional Key CodesFeatures:- Can be defined a wait in seconds before to start the keystroke sending- Can be defined a wait in seconds to give up, if the target windows aren't found- The target window can be the active windows or one with defined title- The syntax of the string to be sent is the same of the VBA Sendkeys statement with some additional key codes not existent in VBA for:1 – Print Screen keys2 – Pauses between sent keys3 – Keypad keys4 – Logoff, restart or shutdown the system5 – Send API virtual keys by their decimal codes– Runs in silence and, optionally, until without fail alert- Can register the execution end saving a log file (Sendkeys.log) in the disk that can be used for synchronization- Can be realized simultaneous instances and keys can be sent to more of one window simultaneously- Running SendKeys.exe without arguments, it shows a dialog with a quick help, a command to test and other command for more detail helpSyntax:Path\SendKeys.exe Arg1 Arg2 Arg3 Arg4 [Arg5]
Arguments are separated by spaces and Arg5 is optional.Arg1 – Wait in seconds or fractions before starting to send keys (This waiting count only starts when the target window is found and activated)Arg2 – Wait in seconds to give up, if the target window isn't foundArg3 – String of target window title (See Note1 and 2)Arg4 – String with keys to be sent (See Note1 and 3 )Arg5 – Optional: 1 – Run in silence without fail alert; 2 – Save a log file (Sendkeys.log) on the disk to mark the execution end and which can be used to synchronize thus: the calling code first deletes this log file, sends the keys, and pauses in a check loop until it is created again to then continue.Note1: Quotation marks are necessary, if there is space in the string.Note2: In place of the window title you can use too the number returned by Shell function. Empty title (Quotation marks without text) sends keys to the active window.Note3: To send special keys, see VBA help for the Sendkeys statement.  See Complete Syntax of the String to Send.Examples:1 – In VBA, you use the Shell function as in the below test code:Sub Test() Dim Ret Shell "Notepad.exe", vbNormalFocus Ret = Shell("Path\SendKeys.exe 1 10 ""Untitled - Notepad"" ""Hello!~{PAUSE}After of 1s.~{PAUSE 2}After of 3s.~""", vbNormalFocus) End Sub2 – In the Windows console, in Windows shortcuts, in DOS BAT, or in the dialog box of Windows Run command, it can be something like:SendKeys.exe 1 10 "Untitled - Notepad" "Hello!~{PAUSE}After of 1s.~{PAUSE 2}After of 3s.~"Complete Syntax of the String to Send:Each key is represented by one or more characters. To specify a single keyboard character, use the character itself. For example, to represent the letter A, use "A" for string. To represent more than one character, append each additional character to the one preceding it. To represent the letters A, B, and C, use "ABC" for string.The plus sign (+), caret (^), percent sign (%), tilde (~), and parentheses ( ) have special meanings to SendKeys. To specify one of these characters, enclose it within braces ({}). For example, to specify the plus sign, use {+}. Brackets ([ ]) have no special meaning to SendKeys, but you must enclose them in braces. In other applications, brackets do have a special meaning that may be significant when dynamic data exchange (DDE) occurs. To specify brace characters, use {{} and {}}.To specify characters that aren't displayed when you press a key, such as ENTER or TAB, and keys that represent actions rather than characters, use the codes shown below:KeyCodeBACKSPACE{BACKSPACE}{BS},
 or {BKSP}BREAK{BREAK}CAPS LOCK{CAPSLOCK}DEL or DELETE{DELETE} or {DEL}DOWN ARROW{DOWN}END{END}ENTER{ENTER}or ~ESC{ESC}HELP{HELP}HOME{HOME}INS or INSERT{INSERT} or {INS}LEFT ARROW{LEFT}NUM LOCK{NUMLOCK}PAGE DOWN{PGDN}PAGE UP{PGUP}RIGHT ARROW{RIGHT}SCROLL LOCK{SCROLLLOCK}TAB{TAB}UP ARROW{UP}F1{F1}F2{F2}F3{F3}F4{F4}F5{F5}F6{F6}F7{F7}F8{F8}F9{F9}F10{F10}F11{F11}F12{F12}F13{F13}F14{F14}F15{F15}F16{F16}
To specify keys combined with any combination of the SHIFT, CTRL, and ALT keys, precede the key code with one or more of the following codes:KeyCodeSHIFT+CTRL^ALT%
To specify that any combination of SHIFT, CTRL, and ALT should be held down while several other keys are pressed, enclose the code for those keys in parentheses. For example, to specify to hold down SHIFT while E and C are pressed, use "+(EC)". To specify to hold down SHIFT while E is pressed, followed by C without SHIFT, use "+EC".To specify repeating keys, use the form {key number}. You must put a space between key and number. For example, {LEFT 42} means press the LEFT ARROW key 42 times; {h 10} means press H 10 times.Notes:
1 – You can't use SendKeys to send keystrokes to an application that is not designed to run in Microsoft Windows.
2 – These standard VBA codes do not distinguish the SHIFT, CTRL and ALT control keys on the right side of the keyboard from the respective keys on the left side. However there are settings that these keys have custom functionality when, for example, using virtual machines, but Extra VBA Additional Key Codes described below allow to distinguish, see example 2 for the codes {VK nn} and {VK_nn}Download:Tested with Microsoft Office for Windows, versions 97 (See Note), 2000, 2002(XP), 2003, 2007, 2010 (32 and 64-bit), 2013 (32 and 64-bit), 2016 (32 and 64-bit), and 2019 (32 and 64-bit) in MSI-based and Click-To-Run installations of Office 365™ cloud-based services.DownloadDownload the English version here   
You also can download from this mirror site   
Last update: 01/11/2020 – 39.3kb    
Freeware based in this License Agreement   Extra VBA Additional Key Codes:These key codes, although they don’t exist in VBA, are also supported here:KeyCodePrint Screen – Full Screen{PRTSC}Print Screen – Active Window%{PRTSC}Pause 1 second{PAUSE}Pause n seconds{PAUSE n} Keypad 0{NUMPAD0}Keypad 1{NUMPAD1}Keypad 2{NUMPAD2}Keypad 3{NUMPAD3}Keypad 4{NUMPAD4}Keypad 5{NUMPAD5}Keypad 6{NUMPAD6}Keypad 7{NUMPAD7}Keypad 8{NUMPAD8}Keypad 9{NUMPAD9}Keypad +{ADD}Keypad -{SUBTRACT}Keypad *{MULTIPLY}Keypad /{DIVIDE}Keypad decimal
Separator{DECIMAL} Sends 'Ctrl + Alt + DEL' keys to POWER
OFF the computer, IF POSSIBLE^%{DEL}  Sends 'Ctrl + Alt + DEL' keys to POWER
OFF the computer, FORCIBLY^%{DEL1}Sends 'Ctrl + Alt + DEL' keys to RESTART
the computer, IF POSSIBLE^%{DEL2}Sends 'Ctrl + Alt + DEL' keys to RESTART
the computer, FORCIBLY^%{DEL3}Sends 'Ctrl + Alt + DEL' keys to LOGOFF
the user, IF POSSIBLE^%{DEL4}Sends 'Ctrl + Alt + DEL' keys to LOGOFF
the user, FORCIBLY.^%{DEL5}Sends the API virtual key of decimal code nn
in NORMAL WAY (downing and releasing){VK nn}Sends the API virtual key of decimal code nn
ONLY DOWNING{VK_nn}With these codes {VK nn} and {VK_nn}, you can send any key or key combinations. Pressing a control button sending its {VK_nn} code, it will be pressed until its {VK nn} normal code is sent. For example:1 – If you want to send the shortcut key composed by ‘Windows Button’ and the letter ‘R’, first send the ‘Windows Button’ key only downing, then the ‘R’ key, and finally the ‘Windows Button’ key normally to release it, like this: {VK_91}{VK 82}{VK 91}2 – If you want to send the shortcut key composed of ALT on the left side of the keyboard and the letter ‘S’, first send that ALT key only downing, then the ‘S’ key, and finally the ALT key normally to release it, like this: {VK_164}{VK 83}{VK 164}The table below was assembled from this vitual-key codes list in MSDN. It lists each of 254 possible decimal numbers for virtual keys with the corresponding physical keys already assigned by Microsoft.DecKeyCodeSymbolic API ConstHex1Left mouse button{VK 1}VK_LBUTTON0x012Right mouse button{VK 2}VK_RBUTTON0x023Control-break processing{VK 3}VK_CANCEL0x034Middle mouse button (three-button mouse){VK 4}VK_MBUTTON0x045Windows 2000/XP: X1 mouse button{VK 5}VK_XBUTTON10x056Windows 2000/XP: X2 mouse button{VK 6}VK_XBUTTON20x067Undefined{VK 7}0x078BACKSPACE key{VK 8}VK_BACK0x089TAB key{VK 9}VK_TAB0x0910Reserved{VK 10}0x0A11Reserved{VK 11}0x0B12CLEAR key{VK 12}VK_CLEAR0x0C13ENTER key{VK 13}VK_RETURN0x0D14Undefined{VK 14}0x0E15Undefined{VK 15}0x0F16SHIFT key{VK 16}VK_SHIFT0x1017CTRL key{VK 17}VK_CONTROL0x1118ALT key{VK 18}VK_MENU0x1219PAUSE key{VK 19}VK_PAUSE0x1320CAPS LOCK key{VK 20}VK_CAPITAL0x1421Input Method Editor (IME) Kana mode, Hanguel, or Hangul mode{VK 21}VK_KANA, VK_HANGUEL, VK_HANGUL0x1522Undefined{VK 22}0x1623IME Junja mode{VK 23}VK_JUNJA0x1724IME final mode{VK 24}VK_FINAL0x1825IME Hanja mode, IME Kanji mode{VK 25}VK_HANJA, VK_KANJI0x1926Undefined{VK 26}0x1A27ESC key{VK 27}VK_ESCAPE0x1B28IME convert{VK 28}VK_CONVERT0x1C29IME nonconvert{VK 29}VK_NONCONVERT0x1D30IME accept{VK 30}VK_ACCEPT0x1E31IME mode change request{VK 31}VK_MODECHANGE0x1F32SPACEBAR{VK 32}VK_SPACE0x2033PAGE UP key{VK 33}VK_PRIOR0x2134PAGE DOWN key{VK 34}VK_NEXT0x2235END key{VK 35}VK_END0x2336HOME key{VK 36}VK_HOME0x2437LEFT ARROW key{VK 37}VK_LEFT0x2538UP ARROW key{VK 38}VK_UP0x2639RIGHT ARROW key{VK 39}VK_RIGHT0x2740DOWN ARROW key{VK 40}VK_DOWN0x2841SELECT key{VK 41}VK_SELECT0x2942PRINT key{VK 42}VK_PRINT0x2A43EXECUTE key{VK 43}VK_EXECUTE0x2B44PRINT SCREEN key{VK 44}VK_SNAPSHOT0x2C45INS key{VK 45}VK_INSERT0x2D46DEL key{VK 46}VK_DELETE0x2E47HELP key{VK 47}VK_HELP0x2F480 key{VK 48}0x30491 key{VK 49}0x31502 key{VK 50}0x32513 key{VK 51}0x33524 key{VK 52}0x34535 key{VK 53}0x35546 key{VK 54}0x36557 key{VK 55}0x37568 key{VK 56}0x38579 key{VK 57}0x3958Undefined{VK 58}0x3A59Undefined{VK 59}0x3B60Undefined{VK 60}0x3C61Undefined{VK 61}0x3D62Undefined{VK 62}0x3E63Undefined{VK 63}0x3F64Undefined{VK 64}0x4065A key{VK 65}0x4166B key{VK 66}0x4267C key{VK 67}0x4368D key{VK 68}0x4469E key{VK 69}0x4570F key{VK 70}0x4671G key{VK 71}0x4772H key{VK 72}0x4873I key{VK 73}0x4974J key{VK 74}0x4A75K key{VK 75}0x4B76L key{VK 76}0x4C77M key{VK 77}0x4D78N key{VK 78}0x4E79O key{VK 79}0x4F80P key{VK 80}0x5081Q key{VK 81}0x5182R key{VK 82}0x5283S key{VK 83}0x5384T key{VK 84}0x5485U key{VK 85}0x5586V key{VK 86}0x5687W key{VK 87}0x5788X key{VK 88}0x5889Y key{VK 89}0x5990Z key{VK 90}0x5A91Left Windows key (Microsoft Natural keyboard){VK 91}VK_LWIN0x5B92Right Windows key (Natural keyboard){VK 92}VK_RWIN0x5C93Applications key (Natural keyboard){VK 93}VK_APPS0x5D94Reserved{VK 94}0x5E95Computer Sleep key{VK 95}VK_SLEEP0x5F96Numeric keypad 0 key{VK 96}VK_NUMPAD00x6097Numeric keypad 1 key{VK 97}VK_NUMPAD10x6198Numeric keypad 2 key{VK 98}VK_NUMPAD20x6299Numeric keypad 3 key{VK 99}VK_NUMPAD30x63100Numeric keypad 4 key{VK 100}VK_NUMPAD40x64101Numeric keypad 5 key{VK 101}VK_NUMPAD50x65102Numeric keypad 6 key{VK 102}VK_NUMPAD60x66103Numeric keypad 7 key{VK 103}VK_NUMPAD70x67104Numeric keypad 8 key{VK 104}VK_NUMPAD80x68105Numeric keypad 9 key{VK 105}VK_NUMPAD90x69106Multiply key{VK 106}VK_MULTIPLY0x6A107Add key{VK 107}VK_ADD0x6B108Separator key{VK 108}VK_SEPARATOR0x6C109Subtract key{VK 109}VK_SUBTRACT0x6D110Decimal key{VK 110}VK_DECIMAL0x6E111Divide key{VK 111}VK_DIVIDE0x6F112F1 key{VK 112}VK_F10x70113F2 key{VK 113}VK_F20x71114F3 key{VK 114}VK_F30x72115F4 key{VK 115}VK_F40x73116F5 key{VK 116}VK_F50x74117F6 key{VK 117}VK_F60x75118F7 key{VK 118}VK_F70x76119F8 key{VK 119}VK_F80x77120F9 key{VK 120}VK_F90x78121F10 key{VK 121}VK_F100x79122F11 key{VK 122}VK_F110x7A123F12 key{VK 123}VK_F120x7B124F13 key{VK 124}VK_F130x7C125F14 key{VK 125}VK_F140x7D126F15 key{VK 126}VK_F150x7E127F16 key{VK 127}VK_F160x7F128F17 key{VK 128}VK_F170x80129F18 key{VK 129}VK_F180x81130F19 key{VK 130}VK_F190x82131F20 key{VK 131}VK_F200x83132F21 key{VK 132}VK_F210x84133F22 key{VK 133}VK_F220x85134F23 key{VK 134}VK_F230x86135F24 key{VK 135}VK_F240x87136Unassigned{VK 136}0x88137Unassigned{VK 137}0x89138Unassigned{VK 138}0x8A139Unassigned{VK 139}0x8B140Unassigned{VK 140}0x8C141Unassigned{VK 141}0x8D142Unassigned{VK 142}0x8E143Unassigned{VK 143}0x8F144NUM LOCK key{VK 144}VK_NUMLOCK0x90145SCROLL LOCK key{VK 145}VK_SCROLL0x91146OEM specific{VK 146}0x92147OEM specific{VK 147}0x93148OEM specific{VK 148}0x94149OEM specific{VK 149}0x95150OEM specific{VK 150}0x96151Unassigned{VK 151}0x97152Unassigned{VK 152}0x98153Unassigned{VK 153}0x99154Unassigned{VK 154}0x9A155Unassigned{VK 155}0x9B156Unassigned{VK 156}0x9C157Unassigned{VK 157}0x9D158Unassigned{VK 158}0x9E159Unassigned{VK 159}0x9F160Left SHIFT key{VK 160}VK_LSHIFT0xA0161Right SHIFT key{VK 161}VK_RSHIFT0xA1162Left CONTROL key{VK 162}VK_LCONTROL0xA2163Right CONTROL key{VK 163}VK_RCONTROL0xA3164Left MENU key{VK 164}VK_LMENU0xA4165Right MENU key{VK 165}VK_RMENU0xA5166Windows 2000/XP: Browser Back key{VK 166}VK_BROWSER_BACK0xA6167Windows 2000/XP: Browser Forward key{VK 167}VK_BROWSER_FORWARD0xA7168Windows 2000/XP: Browser Refresh key{VK 168}VK_BROWSER_REFRESH0xA8169Windows 2000/XP: Browser Stop key{VK 169}VK_BROWSER_STOP0xA9170Windows 2000/XP: Browser Search key{VK 170}VK_BROWSER_SEARCH0xAA171Windows 2000/XP: Browser Favorites key{VK 171}VK_BROWSER_FAVORITES0xAB172Windows 2000/XP: Browser Start and Home key{VK 172}VK_BROWSER_HOME0xAC173Windows 2000/XP: Volume Mute key{VK 173}VK_VOLUME_MUTE0xAD174Windows 2000/XP: Volume Down key{VK 174}VK_VOLUME_DOWN0xAE175Windows 2000/XP: Volume Up key{VK 175}VK_VOLUME_UP0xAF176Windows 2000/XP: Next Track key{VK 176}VK_MEDIA_NEXT_TRACK0xB0177Windows 2000/XP: Previous Track key{VK 177}VK_MEDIA_PREV_TRACK0xB1178Windows 2000/XP: Stop Media key{VK 178}VK_MEDIA_STOP0xB2179Windows 2000/XP: Play/Pause Media key{VK 179}VK_MEDIA_PLAY_PAUSE0xB3180Windows 2000/XP: Start Mail key{VK 180}VK_LAUNCH_MAIL0xB4181Windows 2000/XP: Select Media key{VK 181}VK_LAUNCH_MEDIA_SELECT0xB5182Windows 2000/XP: Start Application 1 key{VK 182}VK_LAUNCH_APP10xB6183Windows 2000/XP: Start Application 2 key{VK 183}VK_LAUNCH_APP20xB7184Reserved{VK 184}0xB8185Reserved{VK 185}0xB9186Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ';:' key{VK 186}VK_OEM_10xBA187Windows 2000/XP: For any country/region, the '+' key{VK 187}VK_OEM_PLUS0xBB188Windows 2000/XP: For any country/region, the ',' key{VK 188}VK_OEM_COMMA0xBC189Windows 2000/XP: For any country/region, the '-' key{VK 189}VK_OEM_MINUS0xBD190Windows 2000/XP: For any country/region, the '.' key{VK 190}VK_OEM_PERIOD0xBE191Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key{VK 191}VK_OEM_20xBF192Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key{VK 192}VK_OEM_30xC0193Reserved{VK 193}0xC1194Reserved{VK 194}0xC2195Reserved{VK 195}0xC3196Reserved{VK 196}0xC4197Reserved{VK 197}0xC5198Reserved{VK 198}0xC6199Reserved{VK 199}0xC7200Unassigned{VK 200}0xC8201Unassigned{VK 201}0xC9202Unassigned{VK 202}0xCA203Unassigned{VK 203}0xCB204Unassigned{VK 204}0xCC205Unassigned{VK 205}0xCD206Unassigned{VK 206}0xCE207Unassigned{VK 207}0xCF208Unassigned{VK 208}0xD0209Unassigned{VK 209}0xD1210Unassigned{VK 210}0xD2211Unassigned{VK 211}0xD3212Unassigned{VK 212}0xD4213Unassigned{VK 213}0xD5214Unassigned{VK 214}0xD6215Unassigned{VK 215}0xD7216Unassigned{VK 216}0xD8217Unassigned{VK 217}0xD9218Unassigned{VK 218}0xDA219Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key{VK 219}VK_OEM_40xDB220Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key{VK 220}VK_OEM_50xDC221Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key{VK 221}VK_OEM_60xDD222Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key{VK 222}VK_OEM_70xDE223Used for miscellaneous characters; it can vary by keyboard.{VK 223}VK_OEM_80xDF224Reserved{VK 224}0xE0225OEM specific{VK 225}0xE1226Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard{VK 226}VK_OEM_1020xE2227OEM specific{VK 227}0xE3228OEM specific{VK 228}0xE4229Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key{VK 229}VK_PROCESSKEY0xE5230OEM specific{VK 230}0xE6231Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT, SendInput, WM_KEYDOWN, and WM_KEYUP{VK 231}VK_PACKET0xE7232Unassigned{VK 232}0xE8233OEM specific{VK 233}0xE9234OEM specific{VK 234}0xEA235OEM specific{VK 235}0xEB236OEM specific{VK 236}0xEC237OEM specific{VK 237}0xED238OEM specific{VK 238}0xEE239OEM specific{VK 239}0xEF240OEM specific{VK 240}0xF0241OEM specific{VK 241}0xF1242OEM specific{VK 242}0xF2243OEM specific{VK 243}0xF3244OEM specific{VK 244}0xF4245OEM specific{VK 245}0xF5246Attn key{VK 246}VK_ATTN0xF6247CrSel key{VK 247}VK_CRSEL0xF7248ExSel key{VK 248}VK_EXSEL0xF8249Erase EOF key{VK 249}VK_EREOF0xF9250Play key{VK 250}VK_PLAY0xFA251Zoom key{VK 251}VK_ZOOM0xFB252Reserved{VK 252}VK_NONAME0xFC253PA1 key{VK 253}VK_PA10xFD254Clear key{VK 254}VK_OEM_CLEAR0xFE  

Comments are closed.