📊 VBA (Excel)

Check Enable Num Lock on Startup Registry Value (VBA)

Reads the Enable Num Lock on Startup registry value via WScript.Shell.RegRead and reports it in a message box — no PowerShell or reg.exe needed.

By WindowsScripting.com · 649 B
EnableNumlockOnStartupRegCheck.bas
Attribute VB_Name = "EnableNumlockOnStartupRegCheck"
Option Explicit

Public Sub EnableNumlockOnStartupRegCheck()
    Dim wsh As Object
    Dim regPath As String
    Dim value As Variant

    Set wsh = CreateObject("WScript.Shell")
    regPath = "HKEY_LOCAL_MACHINE\.DEFAULT\Control Panel\Keyboard\InitialKeyboardIndicators"

    On Error Resume Next
    value = wsh.RegRead(regPath)
    On Error GoTo 0

    If IsEmpty(value) Then
        MsgBox "Value not set:" & vbCrLf & regPath, vbExclamation, "Enable Num Lock on Startup"
    Else
        MsgBox "Enable Num Lock on Startup" & vbCrLf & regPath & " = " & value, vbInformation
    End If
End Sub