Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
NUM LOCK status
I'm sure I remember reading that this was a know problem in excel 97, but I
don't remember the solution: I'm building a tool for various users and it's all driven through forms.... however: when one form closes and another opens the NUM LOCK deselects itself. If I use sendkeys "{numlock}" it selects it again when I step through the code, but when I run it, it doesn't work. I know that numbers can be entered using the number keys above the alpha keys, but most users use the number pad. Is there a piece of code that can detect whether NUM LOCK is selected or not, and reselect it if it isn't? Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
NUM LOCK status
See Dave Peterson's post in this thread
http://tinyurl.com/cuocs Regards, Peter T "Black1" wrote in message ... I'm sure I remember reading that this was a know problem in excel 97, but I don't remember the solution: I'm building a tool for various users and it's all driven through forms.... however: when one form closes and another opens the NUM LOCK deselects itself. If I use sendkeys "{numlock}" it selects it again when I step through the code, but when I run it, it doesn't work. I know that numbers can be entered using the number keys above the alpha keys, but most users use the number pad. Is there a piece of code that can detect whether NUM LOCK is selected or not, and reselect it if it isn't? Thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
NUM LOCK status
Unfortunately I cant get his solution to work, I keep getting "Can't find DLL entry point getkeyboardstate in user32" Any (further) suggestions? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
NUM LOCK status
This works for me in Excel 97:
Declare Sub GetKeyboardState Lib "USER32" (lpKeystate As Any) Declare Sub keybd_event Lib "USER32" _ (ByVal bVk As Byte, ByVal bScan As Byte, _ ByVal dwFlags As Long, ByVal dwExtraInfo As Long) Const KEYEVENTF_EXTENDEDKEY = &H1 Const KEYEVENTF_KEYUP = &H2 Sub NTKeyNumlockOn() Dim lpbKeyState(0 To 255) As Byte GetKeyboardState lpbKeyState(0) If lpbKeyState(vbKeyNumlock) = 0 Then keybd_event vbKeyNumlock, 0, KEYEVENTF_EXTENDEDKEY Or 0, 0 keybd_event vbKeyNumlock, 0, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0 End If End Sub -- Jim "Black1" wrote in message ... | | Unfortunately I cant get his solution to work, I keep getting | | "Can't find DLL entry point getkeyboardstate in user32" | | Any (further) suggestions? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
NUM LOCK status
Try simply -
Declare Function SetKeyboardState _ Lib "User32" (kbArray As Byte) As Long Sub NumLocker() Dim KeyState(0 To 255) As Byte KeyState(&H90) = 1 ' 1 NumLock on, 0 for off SetKeyboardState KeyState(0) End Sub "Black1" wrote in message ... Unfortunately I cant get his solution to work, I keep getting "Can't find DLL entry point getkeyboardstate in user32" Any (further) suggestions? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how do I undo the scroll lock, thscroll lock button does not work | Excel Discussion (Misc queries) | |||
reuest formula for auto update status & status date | Excel Worksheet Functions | |||
Lock Cell status | Excel Discussion (Misc queries) | |||
Need a msg box that displays time status or loading status | Excel Programming | |||
SENDKEYS change the "Number Lock" status | Excel Programming |