Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
When looping through all the controls collection on a form is there a property that can be examined to determine what type of control each control is? Graham |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Graham,
Two approaches. Regards, Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware Sub FindOutWhatKind() Dim Ctrl As MSForms.Control For Each Ctrl In UserForm1.Controls MsgBox TypeName(Ctrl) Next Set Ctrl = Nothing End Sub Sub FindOutWhatKind2() Dim Ctrl As MSForms.Control For Each Ctrl In UserForm1.Controls If TypeOf Ctrl Is MSForms.CheckBox Then MsgBox Ctrl.Name ElseIf TypeOf Ctrl Is MSForms.CommandButton Then MsgBox Ctrl.Name 'more ElseIf End If Next Set Ctrl = Nothing End Sub '---------- "Graham Payne" wrote in message ... Hi, When looping through all the controls collection on a form is there a property that can be examined to determine what type of control each control is? Graham |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Jim,
thanks for that it works atreat. Regards, Graham "Jim Cone" wrote in message ... Graham, Two approaches. Regards, Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware Sub FindOutWhatKind() Dim Ctrl As MSForms.Control For Each Ctrl In UserForm1.Controls MsgBox TypeName(Ctrl) Next Set Ctrl = Nothing End Sub Sub FindOutWhatKind2() Dim Ctrl As MSForms.Control For Each Ctrl In UserForm1.Controls If TypeOf Ctrl Is MSForms.CheckBox Then MsgBox Ctrl.Name ElseIf TypeOf Ctrl Is MSForms.CommandButton Then MsgBox Ctrl.Name 'more ElseIf End If Next Set Ctrl = Nothing End Sub '---------- "Graham Payne" wrote in message ... Hi, When looping through all the controls collection on a form is there a property that can be examined to determine what type of control each control is? Graham |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Nested If statement to control format of number-type cells | Excel Worksheet Functions | |||
Identifying the type of a Worksheet_Change | Excel Programming | |||
Userform Control Type | Excel Programming | |||
Identifying a Control Type | Excel Programming |