Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
looping through userform controls changing enabled and locked properties
Hi All
i'm trying to (Excel 2000) loop through userform controls which are set to enabled = false & locked = true to change them to enabled = true and locked = false on the On Click of a command button. I have John Walkenbach's book (excel 2002) where he shows code for looping through controls but i can't seem to find a way to get to either the enabled or locked properties - everything i tried resulted in excel crashing ! Help! Thanks JulieD |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
looping through userform controls changing enabled and locked properties
This will switch the state of the control as you required, incorporate this
into your control loop to act on each control. Private Sub CommandButton1_Click() With TextBox1 If .Enabled Then .Enabled = False .Locked = True Else .Enabled = True .Locked = False End If End With End Sub Cheers Nigel "JulieD" wrote in message ... Hi All i'm trying to (Excel 2000) loop through userform controls which are set to enabled = false & locked = true to change them to enabled = true and locked = false on the On Click of a command button. I have John Walkenbach's book (excel 2002) where he shows code for looping through controls but i can't seem to find a way to get to either the enabled or locked properties - everything i tried resulted in excel crashing ! Help! Thanks JulieD |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
looping through userform controls changing enabled and locked properties
Julie,
Here is an example Dim ctl As msforms.Control For Each ctl In Me.Controls If TypeName(ctl) = "TextBox" Then If ctl.Enabled Then MsgBox ctl.Name End If End If Next ctl -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "JulieD" wrote in message ... Hi All i'm trying to (Excel 2000) loop through userform controls which are set to enabled = false & locked = true to change them to enabled = true and locked = false on the On Click of a command button. I have John Walkenbach's book (excel 2002) where he shows code for looping through controls but i can't seem to find a way to get to either the enabled or locked properties - everything i tried resulted in excel crashing ! Help! Thanks JulieD |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Controls & their properties etc | Excel Programming | |||
Looping through multiple controls | Excel Programming | |||
Populating Sheet Data From A UserForm Combo Box Enabled For Multi-Choices | Excel Programming | |||
Userform and controls locked property | Excel Programming | |||
Looping thru custom controls | Excel Programming |