Work with only objects in a frame...

S

SupperDuck

Hello all,

Just guess that i have 10 combobox... 5 in frame1 and the other 5 in frame2.

Well, i want to do something like...

code..
dim a as combobox
for each a in frame1

a.enabled = false

next

I must do something more, may be select all objects not only comboboxes or
may be do sth.

But i do not now how to do only the objects which is in the frame that i
want...

Is there a way?

Thanks..
 
G

Gary Keramidas

i use something like this to reset all of the option buttons in frame2 on
userform1, maybe it will give you an idea

Dim cntrl As Control
For Each cntrl In UserForm1.Frame2.Controls
If cntrl.Value = True Then
cntrl.Value = False
End If
Next
 
S

SupperDuck

Thanks.. I will try it..

Gary Keramidas said:
i use something like this to reset all of the option buttons in frame2 on
userform1, maybe it will give you an idea

Dim cntrl As Control
For Each cntrl In UserForm1.Frame2.Controls
If cntrl.Value = True Then
cntrl.Value = False
End If
Next
 
S

SupperDuck

Hello,

I tried with a button...


-
Private Sub CommandButton4_Click()

Dim kontrol As Button

For Each kontrol In UserForm1.Frame2.Buttons

kontrol.Enabled = False

Next

End Sub
 
G

Gary Keramidas

you can't set a command button property to false.

an option button is either clicked, true, or not clicked false.

you have to set the control to an available property, textbox1 = "",
optionbutton1 = true or something like that.

maybe post more code of what you're trying to do and someone will help.
 
N

NickHK

On a userform, you need to work with the controls from MSForms:

Private Sub CommandButton5_Click()
Dim Cont As MSForms.Control

For Each Cont In UserForm1.Frame1.Controls
If TypeOf Cont Is MSForms.CommandButton Then Cont.Enabled = False
Next

End Sub

NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top