SendKeys Statement Doesn't Affect NUM LOCK Key State |
Q133327
When you use the SendKeys statement with the {NUMLOCK} key code in a Visual
Basic, Applications Edition, procedure to send the NUM LOCK key, the NUM
LOCK key state is not affected.
Note that when you use the SendKeys statement to send the NUM LOCK key,
while Microsoft Excel or Microsoft Project is the active application, the
word NUM on the status bar is toggled (either appears or disappears).
However, the NUM LOCK light on your keyboard (which indicates the state of
the NUM LOCK key) does not change.
The expected behavior is for the SendKeys command to turn NUM LOCK off at
the start of the SendKeys command, the {NUMLOCK} key code in the SendKeys
command to toggle the NUM LOCK state, and the NUM LOCK state to be restored
to its original state after the SendKeys command is finished.
In Microsoft Excel, you can use the SendKeys method to work around this behavior, as in the following example:
Sub Test()
Application.SendKeys "{NUMLOCK}This is a test of the NUM LOCK key"
End Sub Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
When NUM LOCK is on, the numbers and mathematical symbols that appear on the numeric keypad will be entered into the worksheet when you press the keys. When NUM LOCK is off, the keypad is mapped to arrows (2,4,6,8) arithmetic functions (=,/,*,-,+,), and the function keys HOME (7), END (1), PgUp (9) , and PgDn (3).
For more information about the SendKeys Statement or the SendKeys Method, choose the Search button in the Visual Basic Reference and type:
SendKeys
Additional query words:
Keywords :
Issue type :
Technology :
|
Last Reviewed: January 15, 2001 © 2001 Microsoft Corporation. All rights reserved. Terms of Use. |