A client claims that a VBA macro is turning numlock off. I looked in the
docs and see no way for VBA to do this - tell whether numlock is on or off,
yes, but change it, no. Any ideas?

Signature
Peter Aitken
Remove the crap from my email address before using.
jbc - 21 Jul 2005 02:11 GMT
Peter,
From help:
NumLock Property
Returns the state of the NUM LOCK key. True if the keys on the numeric key
pad insert numbers, False if the keys move the insertion point. Read-only
Boolean.
NumLock Property Example
This example returns the current state of the NUM LOCK key.
theState = Application.NumLock
Hope this helps.
jbc
> A client claims that a VBA macro is turning numlock off. I looked in the
> docs and see no way for VBA to do this - tell whether numlock is on or off,
> yes, but change it, no. Any ideas?
Peter Aitken - 21 Jul 2005 13:41 GMT
Thanks but please read original message before responding. I *know* how to
tell if numlock is on or off - I need to know if I can change it!!

Signature
Peter Aitken
Remove the crap from my email address before using.
> Peter,
>
[quoted text clipped - 20 lines]
>> off,
>> yes, but change it, no. Any ideas?
Jay Freedman - 21 Jul 2005 02:30 GMT
>A client claims that a VBA macro is turning numlock off. I looked in the
>docs and see no way for VBA to do this - tell whether numlock is on or off,
>yes, but change it, no. Any ideas?
Hi Peter,
There's nothing built into VBA to do this, but VBA can call Win32 API
functions just like VB can. The function SetNumLockKey at
http://www.devx.com/VB-2-the-Max/Tip/19181/0?trk=MSCP works perfectly
well in VBA.
That said, it's unlikely someone slipped this into your client's
system without their knowledge.
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Howard Kaikow - 21 Jul 2005 14:43 GMT
> A client claims that a VBA macro is turning numlock off. I looked in the
> docs and see no way for VBA to do this - tell whether numlock is on or off,
> yes, but change it, no. Any ideas?
Could be that some other software is changing the state.
To determimine whether the cause is your code, I would try the following:
1. Add code to the macro to check the state of NumLock when the macro
starts, and save that state in a variable.
2. Add code to the macro to check the state of NumLock when the macro ends.
If the state has changed, report this and restore the initial state using
the SetNumLockKey API. Of course, you would have to further investigate why
the state is changing.
1st thing to look for is whether your code is using code in libraries that
might cause this.
Another is whether your code is creating. opening, closing docs that might
cause Auto* macro to run, which might use code that causes the problem.
Another cause could be add-ins tat the client has installed and you do not.
For example, when I installed Omni Page Pro Office 14, I found that there is
an AutoClose in that add-in that does something, let's see if I can say this
politely, STUPID!