Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

excel macro disables numlock

655 views
Skip to first unread message

nathan

unread,
Apr 19, 2001, 2:06:51 PM4/19/01
to
In Excel 97, a macro that I wrote in Excel 5.0 turns off NUMLOCK.
Has anybody else experienced this behavior? Anybody know how to fix?
Is there a Visual Basic command that will turn NUMLOCK back on?
Any help would be greatly appreciated.

Tom Ogilvy

unread,
Apr 19, 2001, 8:24:26 PM4/19/01
to
Posted Previously by Jim Rech:

From: Jim Rech (jar...@kpmg.com)
Subject: Re: "sendkeys" number lock problem
Newsgroups: microsoft.public.excel.programming
Date: 2000-11-21 05:09:04 PST

I do not understand what you're trying to do but if it is by chance to turn
NumLock on/off try this:


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


Sub NumOn()
Dim lpbKeyState(128) As Integer
GetKeyboardState lpbKeyState(0)
lpbKeyState(72) = 1
SetKeyboardState lpbKeyState(0)
End Sub

Sub NumOff()
Dim lpbKeyState(128) As Integer
GetKeyboardState lpbKeyState(0)
lpbKeyState(72) = 0
SetKeyboardState lpbKeyState(0)
End Sub


--
Jim Rech
Excel MVP

--
Regards,
Tom Ogilvy

nathan <nat...@qben.com> wrote in message
news:887c01c0c8fb$82750ef0$9ae62ecf@tkmsftngxa02...

0 new messages