How to send + from numeric keypad in Excel / VBA?
I am working on a project at work that mainly screens the screen. I am using VBA to control another system based on input stored in a spreadsheet. The problem I'm running into is that certain fields require the + number from the numeric keypad as the field exit character.
I have no problem using the SendKeys function to populate other fields, but for the life of me in any of the research I've done, I can't figure out how to pass this + in particular. Has anyone had to do this? I feel like there is something simple there that I am not getting ...
Not sure if in 2007, but 2003 and earlier VBA SendKeys don't support sending special keys on the keyboard.
I found this utility which will make keyboard keys, http://cpap.com.br/orlando/SendKeysMore.asp?IdC=New
a source to share
In another life, I wrote a program called PushKeys that bypassed the limitations of the VB SendKeys command, but was syntax compatible and had several other features (such as Sleep, numpad keys). My site he was on no longer works, but luckily someone zipped my PushKeys program here .
There are options for VB, Delphi, C, etc. VB should be pretty easy to work with in VBA.
a source to share
I was able to use AutoIT for some MS Office VBA projects where the only way was keyboard or mouse entry, for example when MS Office doesn't expose anything in the object model but exists in the GUI.
In an AutoIT script, this should work to type the + key on the number pad:
Send("{NUMPADADD}")
You can compile an AutoIT script text file (* .au3) to create an EXE which you can run from VBA:
Dim RetVal As Variant
RetVal = Shell("YourAutoITscript.exe")
You can find AutoIT at www.autoitscript.com
a source to share