Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Controls & their properties etc Frederick Excel Programming 0 April 2nd 04 04:48 PM
Looping through multiple controls rci Excel Programming 2 March 4th 04 08:43 PM
Populating Sheet Data From A UserForm Combo Box Enabled For Multi-Choices R3df1sh[_3_] Excel Programming 1 December 4th 03 08:58 PM
Userform and controls locked property D.S.[_3_] Excel Programming 3 November 28th 03 03:00 PM
Looping thru custom controls papou[_6_] Excel Programming 2 July 23rd 03 04:14 PM


All times are GMT +1. The time now is 06:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"