View Full Version : Set focus on check box value and not on caption
character
04-24-2012, 06:31 AM
Dear all,
I have a userform built in Excel VBA with few checkboxes. I have deleted their captions and my intention is to have focus set on them when using the tab to navigate through the user form.
Is there a way to have this happen?
Best,
character
Tinbendr
04-24-2012, 06:56 AM
Private Sub UserForm_Initialize()
Me.CheckBox1.SetFocus
End Sub
Sets the first checkbox.
In the VBE, on the menu bar, View, Tab order to adjust the order Tab takes through the objects.
character
04-24-2012, 07:15 AM
Hello David,
I tried this, but it does not work as I don't have ant caption around my checkboxes.
Please see the attached file.
Regards,
character
Tinbendr
04-24-2012, 07:43 AM
You'll have to use frames.
But the problem with no captions is that you can't tell which one has the focus.
character
04-24-2012, 07:56 AM
I'm still not able to see the focus on the check box :(
when navigating with the tab i can not notice on what checkbox is the cursor placed :(
character
JKwan
04-24-2012, 08:06 AM
Intead of having no caption, how about putting a space as a caption?
character
04-24-2012, 08:09 AM
it's displayed not at all nice on this approach ;)
there is not an easy way to do such a fine tuning?
character
JKwan
04-24-2012, 08:24 AM
Well, I further examined your claim..... What I found is that because there is no caption, you just do not see the focus. If you hit your space bar, indeed the check box will toggle.
character
04-24-2012, 12:02 PM
yes, I'm aware of what you say, but is there any posibility to see the focus?
Paul_Hossler
04-24-2012, 06:40 PM
yes, I'm aware of what you say, but is there any posibility to see the focus?
How would you like to see that?
Private Sub CkbActive_Enter()
CkbActive.BackColor = &HFF0000
End Sub
Private Sub CkbActive_Exit(ByVal Cancel As MSForms.ReturnBoolean)
CkbActive.BackColor = &H8000000F
End Sub
The only way I could see to to it is to use the CB Enter/Exit events and 'shade' the each of the check boxes.
Paul
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.