Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Make Enable Property = OptionButton.Value for all Controls in Fram

I have an optionbutton in a frame along with a variety of controls. I would
like to enable = True when the Option Button = True and visa versa. The code
below works, but only for TextBoxes. Can this code work for all controls?

Private Sub OptionButton13_Click()

Dim ctrl As Control

For Each ctrl In Me.Frame2.controls
If TypeOf ctrl Is MsForms.TextBox Then
ctrl.Enabled = OptionButton13.Value
End If
Next

End Sub

Thanks,
Ryan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Make Enable Property = OptionButton.Value for all Controls inFram

you're close.......... try this, i think the logic is right. check
the option button value FIRST, then loop through your controls.
===========================
Private Sub OptionButton13_Click()

Dim ctrl As Control

if optionbutton13.value = true then
For Each ctrl In Me.Frame2.controls
If TypeOf ctrl Is MsForms.TextBox Then
ctrl.Enabled = true
End If
Next
end if

End Sub
======================
(someone may have a better idea)
susan



On Jun 19, 8:41*am, RyanH wrote:
I have an optionbutton in a frame along with a variety of controls. *I would
like to enable = True when the Option Button = True and visa versa. *The code
below works, but only for TextBoxes. *Can this code work for all controls?

Private Sub OptionButton13_Click()

Dim ctrl As Control

For Each ctrl In Me.Frame2.controls
* * If TypeOf ctrl Is MsForms.TextBox Then
* * * * *ctrl.Enabled = OptionButton13.Value
* * End If
Next

End Sub

Thanks,
Ryan


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Make Enable Property = OptionButton.Value for all Controls in

I need this loop to work for ALL controls. I have 2 other option buttons, 3
checkboxes, 4 comboboxes, 12 labels all in a frame. I want the enable value
for all these controls to equal optionbutton13.Value. Is this possible?

Thanks,
Ryan


"Susan" wrote:

you're close.......... try this, i think the logic is right. check
the option button value FIRST, then loop through your controls.
===========================
Private Sub OptionButton13_Click()

Dim ctrl As Control

if optionbutton13.value = true then
For Each ctrl In Me.Frame2.controls
If TypeOf ctrl Is MsForms.TextBox Then
ctrl.Enabled = true
End If
Next
end if

End Sub
======================
(someone may have a better idea)
susan



On Jun 19, 8:41 am, RyanH wrote:
I have an optionbutton in a frame along with a variety of controls. I would
like to enable = True when the Option Button = True and visa versa. The code
below works, but only for TextBoxes. Can this code work for all controls?

Private Sub OptionButton13_Click()

Dim ctrl As Control

For Each ctrl In Me.Frame2.controls
If TypeOf ctrl Is MsForms.TextBox Then
ctrl.Enabled = OptionButton13.Value
End If
Next

End Sub

Thanks,
Ryan



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Make Enable Property = OptionButton.Value for all Controls in

i think you'll have to specify each type of control.

If TypeOf ctrl Is MsForms.combobox Then
ctrl.enabled = true
end if

If TypeOf ctrl Is MsForms.label Then
etc
If TypeOf ctrl Is MsForms.optionbutton Then
etc
If TypeOf ctrl Is MsForms.checkbox Then
etc

AFAIK you can't select all forms of controls without identifying them
separately.
but i could be wrong.
susan


On Jun 19, 10:00*am, RyanH wrote:
I need this loop to work for ALL controls. *I have 2 other option buttons, 3
checkboxes, 4 comboboxes, 12 labels all in a frame. *I want the enable value
for all these controls to equal optionbutton13.Value. *Is this possible?

Thanks,
Ryan



"Susan" wrote:
you're close.......... *try this, i think the logic is right. *check
the option button value FIRST, then loop through your controls.
===========================
Private Sub OptionButton13_Click()


*Dim ctrl As Control


if optionbutton13.value = true then
* * * For Each ctrl In Me.Frame2.controls
* * * * * *If TypeOf ctrl Is MsForms.TextBox Then
* * * * * * * * * ctrl.Enabled = true
* * * * * *End If
* * *Next
end if


End Sub
======================
(someone may have a better idea)
susan


On Jun 19, 8:41 am, RyanH wrote:
I have an optionbutton in a frame along with a variety of controls. *I would
like to enable = True when the Option Button = True and visa versa. *The code
below works, but only for TextBoxes. *Can this code work for all controls?


Private Sub OptionButton13_Click()


Dim ctrl As Control


For Each ctrl In Me.Frame2.controls
* * If TypeOf ctrl Is MsForms.TextBox Then
* * * * *ctrl.Enabled = OptionButton13.Value
* * End If
Next


End Sub


Thanks,
Ryan- Hide quoted text -


- Show quoted text -


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Make Enable Property = OptionButton.Value for all Controls in

I was trying to avoid that, but I guess it will work. I currently have all
the controls as a collection, but I was just hoping for a more simple was of
coding it.

Thanks for the help,
Ryan


"Susan" wrote:

i think you'll have to specify each type of control.

If TypeOf ctrl Is MsForms.combobox Then
ctrl.enabled = true
end if

If TypeOf ctrl Is MsForms.label Then
etc
If TypeOf ctrl Is MsForms.optionbutton Then
etc
If TypeOf ctrl Is MsForms.checkbox Then
etc

AFAIK you can't select all forms of controls without identifying them
separately.
but i could be wrong.
susan


On Jun 19, 10:00 am, RyanH wrote:
I need this loop to work for ALL controls. I have 2 other option buttons, 3
checkboxes, 4 comboboxes, 12 labels all in a frame. I want the enable value
for all these controls to equal optionbutton13.Value. Is this possible?

Thanks,
Ryan



"Susan" wrote:
you're close.......... try this, i think the logic is right. check
the option button value FIRST, then loop through your controls.
===========================
Private Sub OptionButton13_Click()


Dim ctrl As Control


if optionbutton13.value = true then
For Each ctrl In Me.Frame2.controls
If TypeOf ctrl Is MsForms.TextBox Then
ctrl.Enabled = true
End If
Next
end if


End Sub
======================
(someone may have a better idea)
susan


On Jun 19, 8:41 am, RyanH wrote:
I have an optionbutton in a frame along with a variety of controls. I would
like to enable = True when the Option Button = True and visa versa. The code
below works, but only for TextBoxes. Can this code work for all controls?


Private Sub OptionButton13_Click()


Dim ctrl As Control


For Each ctrl In Me.Frame2.controls
If TypeOf ctrl Is MsForms.TextBox Then
ctrl.Enabled = OptionButton13.Value
End If
Next


End Sub


Thanks,
Ryan- Hide quoted text -


- Show quoted text -





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,117
Default Make Enable Property = OptionButton.Value for all Controls in

i've got 2 other ideas that might help.........
#1 - why not make the entire frame visible or not visible based on
that optionbutton13? that would take care of all those pesky
individual controls. unless, of course, optionbutton13 is INSIDE the
frame already.......
#2 - why not give all those controls a group name - then you won't
have to loop thru each control as a type, just as a group name.

sorry i wasn't of more assistance. try also searching the newsgroup
for control collection & maybe something else will come up.
susan


On Jun 19, 10:25*am, RyanH wrote:
I was trying to avoid that, but I guess it will work. *I currently have all
the controls as a collection, but I was just hoping for a more simple was of
coding it.

Thanks for the help,
Ryan



"Susan" wrote:
i think you'll have to specify each type of control.


If TypeOf ctrl Is MsForms.combobox Then
* * *ctrl.enabled = true
end if


If TypeOf ctrl Is MsForms.label Then
etc
If TypeOf ctrl Is MsForms.optionbutton Then
etc
If TypeOf ctrl Is MsForms.checkbox Then
etc


AFAIK you can't select all forms of controls without identifying them
separately.
but i could be wrong.
susan


On Jun 19, 10:00 am, RyanH wrote:
I need this loop to work for ALL controls. *I have 2 other option buttons, 3
checkboxes, 4 comboboxes, 12 labels all in a frame. *I want the enable value
for all these controls to equal optionbutton13.Value. *Is this possible?


Thanks,
Ryan


"Susan" wrote:
you're close.......... *try this, i think the logic is right. *check
the option button value FIRST, then loop through your controls.
===========================
Private Sub OptionButton13_Click()


*Dim ctrl As Control


if optionbutton13.value = true then
* * * For Each ctrl In Me.Frame2.controls
* * * * * *If TypeOf ctrl Is MsForms.TextBox Then
* * * * * * * * * ctrl.Enabled = true
* * * * * *End If
* * *Next
end if


End Sub
======================
(someone may have a better idea)
susan


On Jun 19, 8:41 am, RyanH wrote:
I have an optionbutton in a frame along with a variety of controls. *I would
like to enable = True when the Option Button = True and visa versa. *The code
below works, but only for TextBoxes. *Can this code work for all controls?


Private Sub OptionButton13_Click()


Dim ctrl As Control


For Each ctrl In Me.Frame2.controls
* * If TypeOf ctrl Is MsForms.TextBox Then
* * * * *ctrl.Enabled = OptionButton13.Value
* * End If
Next


End Sub


Thanks,
Ryan- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 389
Default Make Enable Property = OptionButton.Value for all Controls in Fram

You could also assign each control a tag value and then loop through all
controls.

Dim ctrl As Control
For Each ctrl In Me.Controls
If ctrl.Tag = "EnableDisableMe" Then
...
End If
Next


--
Tim Zych
www.higherdata.com
Compare data in worksheets and find differences with Workbook Compare
A free, powerful, flexible Excel utility


"RyanH" wrote in message
...
I have an optionbutton in a frame along with a variety of controls. I
would
like to enable = True when the Option Button = True and visa versa. The
code
below works, but only for TextBoxes. Can this code work for all controls?

Private Sub OptionButton13_Click()

Dim ctrl As Control

For Each ctrl In Me.Frame2.controls
If TypeOf ctrl Is MsForms.TextBox Then
ctrl.Enabled = OptionButton13.Value
End If
Next

End Sub

Thanks,
Ryan



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Make Enable Property = OptionButton.Value for all Controls in

Did you see my reply to your other post? It explains the problem and offers
a solution.

Rick


"RyanH" wrote in message
...
I was trying to avoid that, but I guess it will work. I currently have all
the controls as a collection, but I was just hoping for a more simple was
of
coding it.

Thanks for the help,
Ryan


"Susan" wrote:

i think you'll have to specify each type of control.

If TypeOf ctrl Is MsForms.combobox Then
ctrl.enabled = true
end if

If TypeOf ctrl Is MsForms.label Then
etc
If TypeOf ctrl Is MsForms.optionbutton Then
etc
If TypeOf ctrl Is MsForms.checkbox Then
etc

AFAIK you can't select all forms of controls without identifying them
separately.
but i could be wrong.
susan


On Jun 19, 10:00 am, RyanH wrote:
I need this loop to work for ALL controls. I have 2 other option
buttons, 3
checkboxes, 4 comboboxes, 12 labels all in a frame. I want the enable
value
for all these controls to equal optionbutton13.Value. Is this
possible?

Thanks,
Ryan



"Susan" wrote:
you're close.......... try this, i think the logic is right. check
the option button value FIRST, then loop through your controls.
===========================
Private Sub OptionButton13_Click()

Dim ctrl As Control

if optionbutton13.value = true then
For Each ctrl In Me.Frame2.controls
If TypeOf ctrl Is MsForms.TextBox Then
ctrl.Enabled = true
End If
Next
end if

End Sub
======================
(someone may have a better idea)
susan

On Jun 19, 8:41 am, RyanH wrote:
I have an optionbutton in a frame along with a variety of controls.
I would
like to enable = True when the Option Button = True and visa versa.
The code
below works, but only for TextBoxes. Can this code work for all
controls?

Private Sub OptionButton13_Click()

Dim ctrl As Control

For Each ctrl In Me.Frame2.controls
If TypeOf ctrl Is MsForms.TextBox Then
ctrl.Enabled = OptionButton13.Value
End If
Next

End Sub

Thanks,
Ryan- Hide quoted text -

- Show quoted text -




  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 586
Default Make Enable Property = OptionButton.Value for all Controls in

yes i did, thanks again.

"Rick Rothstein (MVP - VB)" wrote:

Did you see my reply to your other post? It explains the problem and offers
a solution.

Rick


"RyanH" wrote in message
...
I was trying to avoid that, but I guess it will work. I currently have all
the controls as a collection, but I was just hoping for a more simple was
of
coding it.

Thanks for the help,
Ryan


"Susan" wrote:

i think you'll have to specify each type of control.

If TypeOf ctrl Is MsForms.combobox Then
ctrl.enabled = true
end if

If TypeOf ctrl Is MsForms.label Then
etc
If TypeOf ctrl Is MsForms.optionbutton Then
etc
If TypeOf ctrl Is MsForms.checkbox Then
etc

AFAIK you can't select all forms of controls without identifying them
separately.
but i could be wrong.
susan


On Jun 19, 10:00 am, RyanH wrote:
I need this loop to work for ALL controls. I have 2 other option
buttons, 3
checkboxes, 4 comboboxes, 12 labels all in a frame. I want the enable
value
for all these controls to equal optionbutton13.Value. Is this
possible?

Thanks,
Ryan



"Susan" wrote:
you're close.......... try this, i think the logic is right. check
the option button value FIRST, then loop through your controls.
===========================
Private Sub OptionButton13_Click()

Dim ctrl As Control

if optionbutton13.value = true then
For Each ctrl In Me.Frame2.controls
If TypeOf ctrl Is MsForms.TextBox Then
ctrl.Enabled = true
End If
Next
end if

End Sub
======================
(someone may have a better idea)
susan

On Jun 19, 8:41 am, RyanH wrote:
I have an optionbutton in a frame along with a variety of controls.
I would
like to enable = True when the Option Button = True and visa versa.
The code
below works, but only for TextBoxes. Can this code work for all
controls?

Private Sub OptionButton13_Click()

Dim ctrl As Control

For Each ctrl In Me.Frame2.controls
If TypeOf ctrl Is MsForms.TextBox Then
ctrl.Enabled = OptionButton13.Value
End If
Next

End Sub

Thanks,
Ryan- Hide quoted text -

- Show quoted text -




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
Error saying Control object does not have Enable property. MikeAllgood Excel Programming 2 March 11th 08 12:24 AM
MultiPage: How to enable controls in Frame on Page Tetsuya Oguma Excel Programming 0 November 6th 06 02:51 AM
ddm enable/disable: Object doesn't support this property, my a** it doesn't William DeLeo Excel Discussion (Misc queries) 3 June 14th 06 06:57 PM
How get a row number of the controls(sample:optionbutton) cyberarmao Excel Programming 2 June 5th 06 08:43 AM
Enable and disable worksheet controls? William Deleo Excel Programming 8 December 23rd 03 12:59 PM


All times are GMT +1. The time now is 08:14 PM.

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

About Us

"It's about Microsoft Excel"