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

Remove the crap from my email address before using.

RE: VBA and numlock. by jbc

jbc
Wed Jul 20 20:11:02 CDT 2005

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

"Peter Aitken" wrote:

> 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
>
> Remove the crap from my email address before using.
>
>
>

Re: VBA and numlock. by Jay

Jay
Wed Jul 20 20:30:10 CDT 2005

On Wed, 20 Jul 2005 16:28:29 -0400, "Peter Aitken"
<paitken@CRAPnc.rr.com> wrote:

>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

Re: VBA and numlock. by Peter

Peter
Thu Jul 21 07:41:25 CDT 2005

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!!

--
Peter Aitken

Remove the crap from my email address before using.
"jbc" <jbc@discussions.microsoft.com> wrote in message
news:F0DEA977-1F77-46AB-B6B4-58E5A0682603@microsoft.com...
> 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
>
> "Peter Aitken" wrote:
>
>> 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
>>
>> Remove the crap from my email address before using.
>>
>>
>>



Re: VBA and numlock. by Howard

Howard
Thu Jul 21 08:43:55 CDT 2005

"Peter Aitken" <paitken@CRAPnc.rr.com> wrote in message
news:O5QQZmWjFHA.3568@tk2msftngp13.phx.gbl...
> 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!