On 2002-05-11 17:58, elgringo56 wrote:
You did so good for me the other day, wanna try to help me on this. I want to turn on and turn off Caps lock under macro control so that when I wnat the operator to input in caps I can make her do it. She wont have to remember. Ivan tried to help me but I dont understand what it is he is trying to have me do.
There does not appear to be anything wrong with Ivan's code. You just have to install it properly.
However, here's an alternative way to do it without API calls :-
- Add a blank worksheet to your workbook and name it Caps Status. Hide this worksheet.
- Put the following two macros in a normal module and assign them to a button each.
Sub Caps_On()
Sheets("Caps Status").[A1].Value = "Caps On"
End Sub
Sub Caps_Off()
Sheets("Caps Status").[A1].Value = "Caps Off"
End Sub
- Put the following in the input worksheet's module
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
If Sheets("Caps Status").[A1].Value = "Caps On" Then
Application.EnableEvents = False
For Each cell In Selection
If cell.HasFormula = False Then
cell.Value = UCase(cell.Value)
End If
Next
Application.EnableEvents = True
End If
End Sub
Note :
When the Caps_On button is clicked, any input thereafter will automatically be capitals until the Caps_Off button is clicked.
When the Caps_Off button is clicked, input will be displayed in the normal way (i.e. capitals if the CapsLock key on the keyboard has been pressed, otherwise lower case).