Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would like to loop through all controls on a custom form and only process
those that are checkbox controls, or textboxes, or labels, etc. In VBA form module, I was thinking it would be possible to do something like this: dim c as control for each c in me.controls if c.type = xlcheckbox (or whatever the correct constant should be) then checkboxCount = checkboxCount + 1 end if next c The problem is that there isn't a type property for a control. Can someone tell me how to do this. I read in help that it was possible to loop thru the controls on worksheets by looping through the shapes collection, testing to see if it is a control, then testing to see if it is a checkbox; however I am interested in looping through controls on a form. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe this will work:
Dim s as Shape For Each s In Worksheets(mySheet).Shapes If s.Type = msoFormControl Then If s.FormControlType = xlCheckBox Then _ 'Do something fabulous End If Next "John T Ingato" wrote: I would like to loop through all controls on a custom form and only process those that are checkbox controls, or textboxes, or labels, etc. In VBA form module, I was thinking it would be possible to do something like this: dim c as control for each c in me.controls if c.type = xlcheckbox (or whatever the correct constant should be) then checkboxCount = checkboxCount + 1 end if next c The problem is that there isn't a type property for a control. Can someone tell me how to do this. I read in help that it was possible to loop thru the controls on worksheets by looping through the shapes collection, testing to see if it is a control, then testing to see if it is a checkbox; however I am interested in looping through controls on a form. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
2007 Form Control/ActiveX Control font difference | Excel Discussion (Misc queries) | |||
Control on a form to find a record | Excel Discussion (Misc queries) | |||
Identifying Control type | Excel Programming | |||
Tool Tip Text for Form control/ Active-X control | Excel Programming | |||
Identifying a Control Type | Excel Programming |