Unsuccessful FOR NEXT loop
I
Unsuccessful FOR NEXT loop
I

This month, every Windows Secrets subscriber can download a one-chapter excerpt of Windows 7: The Missing Manual.Windows 7: The Missing Manual provides valuable information to help you overcome these difficulties in learning a new operating system. Subscribe today to download your free excerpt.
I don't have a good way to test this, so I will make two suggestions in the hope that one of them will work.
1- Try changing the Dim to:
<pre>Dim ctl As Object
</pre>
This may fail when you try to reference ctl.tag
2-
Try changing the function to this:
<pre>'converts commandBar combo box listindex to a meaningful value...
Function convertListIndex()
Dim ctl As CommandBarComboBox
On Error Resume Next
For Each ctl In CommandBars("Filter Toolbar").Controls
If ctl.Tag = "1" Then
filterYear = yearCombo.Text
End If
'
If ctl.Tag = "2" Then
filterType = typeCombo.Text
End If
Next ctl
On Error GoTo 0
End Function
</pre>
Legare Coleman
Can you use the TypeName function here?
For each ctl.....
If TypeName(ctl) = "ComboBox" then....
Close. This will do it:
Dim ctl As CommandBarControl
Then loop through the CommandBar's controls collection and test the typename like this:
If TypeName(ctl) = "CommandBarComboBox" Then ... etc.
Charlotte
Well, your suggestion 1 seems to be working!