Turn number lock on

gavinkelly

Board Regular
Joined
Jan 12, 2008
Messages
220
I am running a code but for some reason it turns the number lock off.

What code turns the number lock on. I am using windows vista with excel 2003.

Thanks
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Thanks but how do I set a reference to the "windows script host model" it errors at the wsh.regwrite line.

Sub TurnNumLockOn()
'Before running you must set a reference to the "Windows Script Host Model"
Dim wsh 'Windows Script Host
Dim strRegName As String 'registry string
strRegName = "HKEY_USERS\.DEFAULT\Control Panel\Keyboard\InitialKeyboardIndicators"
Set wsh = CreateObject("WScript.Shell")
wsh.RegWrite strRegName, 2
End Sub

cheers
 
Upvote 0
Also, any ideas why the number lock turns itself off, this is the first time it has done so and the only different type of line of code i am using is the
AppActivate Title:=...
SendKeys String:= ....

???
 
Upvote 0
I have no clue why Num Locks would be shutting off.

As for the WSH do a google search for it, there are a few relevant posts on VBA Express that discuss it with more familiarity than I have.
 
Upvote 0

Forum statistics

Threads
1,222,046
Messages
6,163,588
Members
451,846
Latest member
ajk99

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top