Hey there
Just a minor addition: In the following line, you could also
use dynamic type checking instead of string comparison:
[...]
If TypeName(cntl) = "ComboBox" Then
' Got one!
Debug.Print cntl.Name
End If
[...]
Here's what I mean:
[...]
If TypeOf ctrl Is ComboBox Then
' Got one!
...
End If
[...]
The advantage of this approach is that VBA does not allow
spelling errors. In the above example, you could always write
something like "CombboBox" which will not generate a
compiler error but will result in something else than the
expected runtime-behaviour. However, in the dynamic
type-checking example, VBA would complain when writing
something like ... TypeOf ctrl Is CombboBox ... since there
is no type CombboBox.
Cheers,
Martin