Here's one way. I'm sure there are others.
'put these declarations at the top of the module
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long)
As Integer
Private Const kCapital = 20
Private Const kNumlock = 144
Public Function CapsLock() As Boolean
CapsLock = KeyState(kCapital)
End Function
Public Function NumLock() As Boolean
NumLock = KeyState(kNumlock)
End Function
Private Function KeyState(lKey As Long) As Boolean
KeyState = CBool(GetKeyState(lKey))
End Function
Robin Hammond
www.enhanceddatasystems.com