View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Work with only objects in a frame...

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

"SupperDuck" wrote in message
...
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



--

but got the error, "Object doesn't support this property or method"

:(


"SupperDuck" wrote:

Thanks.. I will try it..

"Gary Keramidas" wrote:

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

--


Gary


"SupperDuck" wrote in message
...
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..