View Full Version : Word 2003 Userform Textbox disable
wilma
03-06-2008, 12:01 PM
I have a Word userform containing a number of textboxes and
one checkbox.
When the user puts a checkmark in the checkbox, one particular textbox
must be disabled, so that no text can be entered in that textbox.
All other texboxes must remain enabled.
Can anyone help me , please ? Thank you !
Tinbendr
03-06-2008, 03:41 PM
Using the Checkbox event, this should toggle the textbox on and off in relation to the checkbox.
Private Sub Checkbox1_change()
If CheckBox1 Then
txtTexbox1.Enabled = False
Else
txtTexbox1.Enabled = True
End If
End Sub
Tommy
03-06-2008, 04:52 PM
This just because I love a one liner ALMOST better than anything!
Just for Sanity's sake the change and click event both fire there is really no difference.
Private Sub CheckBox1_Click()
TextBox1.Enabled = Not TextBox1.Enabled
End Sub
Hi Tinbender :hi: I'm from Starpatch just a little south of Possum Town :thumb
Tinbendr
03-06-2008, 08:54 PM
This just because I love a one liner ALMOST better than anything!
Private Sub CheckBox1_Click()
TextBox1.Enabled = Not TextBox1.Enabled
End Sub
I love it!
I still don't quite think that way. (But then, I'm self taught)
Hi Tinbender :hi: I'm from Starpatch just a little south of Possum Town :thumbI left PT after I got married. I stayed gone about 8 years, but got sucked back after CAFB when to civilian contract on aircraft maintenance.
Tommy
03-07-2008, 07:41 AM
But then, I'm self taught
I am also :)
My Dad was stationed at CAFB in the 60's. I have seen that place pack up and literally fly off LOL it was something to see. I'll have to make it back home this year or my brother and sisters are going to string me up.
wilma
03-08-2008, 09:49 AM
Using the Checkbox event, this should toggle the textbox on and off in relation to the checkbox.
Private Sub Checkbox1_change()
If CheckBox1 Then
txtTexbox1.Enabled = False
Else
txtTexbox1.Enabled = True
End If
End Sub
Thank you so much, Tinebndr. That's exactly what I was looking for.
Wilma
wilma
03-08-2008, 09:50 AM
To both Tommy and Tinbendr : Thank you both very much, that's exactly
what I was looking for.
Wilma
sessionone
04-28-2009, 01:56 PM
Hi all,
I was looking for the similar thing and your suggestions work great.
However, I would also like the textbox to change colour when it's disabled.
Thanks for help
Sessionone
Tommy
04-29-2009, 09:01 AM
Hi sessionone,
The below will change the color of the textbox to another color depending on if it is enabled or not.
TextBox1.Enabled = Not TextBox1.Enabled
If TextBox1.Enabled Then
TextBox1.BackColor = &H80000005
Else
TextBox1.BackColor = &H80000003
End If
Hope this helps :)
sessionone
04-29-2009, 03:05 PM
Cheers Tommy,
I'll try this as soon I get my file working. All of a sudden I can't open it :angry2:. Bummer.....
sessionone
sessionone
05-07-2009, 02:57 PM
Hi,
It worked!!!!!Cheers. Many more questions on the way :)
sessionone
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.