Problem with number lock

G

Guest

This is frustrating me beyond words....

I'm building an excel based tool around a number of userforms and the
problem is this:

The user enters is password into a textbox, hits enter... and then the
numberlock switches itself off... I don't get it, why is it doing this?

It's annoying because you have to keep reselecting number lock and this
makes the whole thing look very amateur... is there some code I can use to
turn it back on, or am I doing something stupid that's making it do it in the
first place?

I'm using excel 97,

Thanks, in anticpation...
 
B

Bob Phillips

Not tried in Excel 97

Declare Sub SetKeyboardState Lib "USER32" (lpKeystate As Any)
Declare Sub GetKeyboardState Lib "USER32" (lpKeystate As Any)


Function TurnNumLockOn()
Dim lpbKeyState(128) As Long
GetKeyboardState lpbKeyState(0)
lpbKeyState(72) = 1
SetKeyboardState lpbKeyState(0)
End Function


--

HTH

RP
(remove nothere from the email address if mailing direct)
 
G

Guest

Bob....

Thanks for your (very) quick response.

Unfortunately..... I can't get it to work, I get run time error 453 "Can't
find DLL entry point in USER32"
 
G

Guest

Okay, I've isolated the problem to the line

SendKeys ("{tab}")

Guess I'll take it out and find a work around.

Thanks anyway!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top