optioncutton and focus

  • Thread starter Thread starter Len
  • Start date Start date
L

Len

I have a userform with three text boxes and nine
optionbuttons. The optionbuttons are in one group. When I
tab through the optionbuttons I want the focus to move
from one optionbutton to another and have the optionbutton
take focus (i.e. get the dot in the button). Tabbing
causes the caption on the optionbutton to be highlighted
but the option button actually does not get focus (i.e.
OptionButton1.Value = False). I want "OptionButton1.Value
= True" to occur when I tab to the optionbutton. How do I
get this to happen?
 
Hi!

Something like it can be done by using the mousemove event.

Put in your code behind the user form 3 sub-routines:

Private Sub OptionButton1_MouseMove(ByVal Button As Integer, ByVa
Shift As Integer, ByVal X As Single, ByVal Y As Single)
OptionButton1.Value = 1
End Sub

and similar ones for optionbutton2 and -3.

As your mouse pointer moves over an option button, it will activate it
If the buttons are enclosed in a frame they will be mutually exclusive
so moving to one will switch off the others.

I'm not sure about tabbing, though.

Al
 
Back
Top