User Form Input Question
I would not use SendKeys to do what you are doing... instead, I would just
assign the values to the TextBox directly. I would also use the Label's
Caption property to make the assignment. Here is a start of the code you
would need to do this...
' This is the routine to toggle the Label
' captions between upper and lower case...
' Label2 assumed because you posted that
Private Sub Label2_Click()
Dim C As Control
For Each C In Me.Controls
If TypeOf C Is MSForms.Label Then
If C.Caption < "CapsLock" Then
If C.Caption = UCase(C.Caption) Then
C.Caption = LCase(C.Caption)
Else
C.Caption = UCase(C.Caption)
End If
End If
End If
Next
End Sub
' Each letter/number/symbol label would look like
' this except for the Label name in the assigment
Private Sub Label1_Click()
TextBox1.SelText = Label1.Caption
End Sub
' Each letter/number/symbol label would look like
' this except for the Label name in the assigment
Private Sub Label3_Click()
TextBox1.SelText = Label3.Caption
End Sub
etc....
Note that you can omit the comments in your actual code, they are there for
instruction purposes only.
--
Rick (MVP - Excel)
"brichard429" wrote in message
...
I am designing a User Form to allow someone to enter their name. There is
no
keyboard only a mouse for input. I have the alphabet represented by using
Label Objects. Each lable has the appropriate caption A,B C etc. I use
the
SendKeys method to enter letters in the Text Box when the appropriate
lable
is clicked. Example:
Private Sub Label3_Click()
SendKeys ("b")
End Sub
I also have a lable to set capslock:
Private Sub Label2_Click()
SendKeys ("{CAPSLOCK}")
End Sub
I would like the caption on each all of the letter labels to change with
the state of Capslock. In other words when CapsLock is on the label would
read "A" and when CapsLock is off the lable would read "a" etc. for all
the
letters. I'm sure there's a way to do this using the vbKeyCapital
constant
but I don't know how.
--
Bernie
|