And can I set it from VBA?
Rodney
Joe
Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As
Long
Public Declare Function GetKeyboardState Lib "user32" (kbArray As
KeyboardBytes) As Long
Public Declare Function SetKeyboardState Lib "user32" (kbArray As
KeyboardBytes) As Long
Public Type KeyboardBytes
kbByte(0 To 255) As Byte
End Type
Public kbArray As KeyboardBytes
Public CapsLock As Boolean
Public kbOld As KeyboardBytes
Global Const VK_CAPSLOCK = &H14
Global Const VK_NUMLOCK = &H90
Global Const VK_SCROLL = &H91
Public Sub TurnOn(vkKey As Long)
'save the original keyboard state
GetKeyboardState kbOld
'Get the keyboard state
GetKeyboardState kbArray
'Change a key
kbArray.kbByte(vkKey) = 1
'Set the keyboard state
SetKeyboardState kbArray
End Sub
Public Sub TurnOff(vkKey As Long)
'save the original keyboard state
GetKeyboardState kbOld
'Get the keyboard state
GetKeyboardState kbArray
'change a key
kbArray.kbByte(vkKey) = 0
'set the keyboard state
SetKeyboardState kbArray
End Sub
Public Sub Reset()
'restore the old keyboard state
SetKeyboardState kbOld
End Sub
Public Function IsCapsLock() As Boolean
If GetKeyState(VK_CAPSLOCK) And 1 Then
IsCapsLock = True
Else
IsCapsLock = False
End If
End Function
Public Function IsNumLock() As Boolean
If GetKeyState(VK_NUMLOCK) And 1 Then
IsNumLock = True
Else
IsNumLock = False
End If
End Function
Public Function IsScrollLock() As Boolean
If GetKeyState(VK_SCROLL) And 1 Then
IsScrollLock = True
Else
IsScrollLock = False
End If
End Function
Rodney D. Lester <rle...@gardnermetal.com> wrote in message
news:f08a0...@WebX.maYIadrTaRb...