ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Work with only objects in a frame... (https://www.excelbanter.com/excel-programming/392530-work-only-objects-frame.html)

SupperDuck

Work with only objects in a frame...
 
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..



Gary Keramidas

Work with only objects in a frame...
 
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..





SupperDuck

Work with only objects in a frame...
 
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..






SupperDuck

Work with only objects in a frame...
 
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..






Gary Keramidas

Work with only objects in a frame...
 
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.


--


Gary


"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..








NickHK

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..









All times are GMT +1. The time now is 07:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com