none
How to detect CapsLock on or off RRS feed

  • Question

  • Hello

    Is there a simple way within a macro, to check whether the CapsLock is on?

    Simple as this?

    Sub MakroCapsLock()

    Dim CapsLock as Integer

    If Capslock = ON then

    MsgBox "CapsLock ON!", vbCritical + vbOKOnly, "CapsLock"

    End Sub

    Thursday, September 13, 2018 9:41 PM

All replies

  • Hi

    Here is some code to do it.

        If Control.IsKeyLocked(Keys.CapsLock) Then
          MessageBox.Show("Caps Lock  ON.")
        Else
          MessageBox.Show("Caps Lock  OFF.")
        End If
    


    Regards Les, Livingston, Scotland

    • Proposed as answer by LeonCS Tuesday, September 18, 2018 4:44 AM
    Thursday, September 13, 2018 9:53 PM
  •  You can also use the following...

            If My.Computer.Keyboard.CapsLock Then
                MessageBox.Show("CapsLock On")
            End If
    


    If you say it can`t be done then i`ll try it

    • Proposed as answer by LeonCS Tuesday, September 18, 2018 4:44 AM
    Thursday, September 13, 2018 10:44 PM