Unsuccessful FOR NEXT loop
I’d appreciate any help on resolving below which I’ve been trying to clear or get around, unsuccessfully.
I wrote the code to examine command bar combo controls and transform the list index into a value in some other variable. Problem is that my command bar also has a button and the for loop crashes on it’s NEXT CTL statement. The error give is run time error 13 “Type mismatch”
I’ve wrestled trying to tell the loop to avoid anything but a combo box, but am unsuccessful thus far, any help is appreciated. The code below is my original problem function, I’ve gone through some other versions as well trying to get rid of the problem but no good so far.
'converts commandBar combo box listindex to a meaningful value...
Function convertListIndex()
Dim ctl As CommandBarComboBox
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
End Function
I’d appreciate any help on resolving below which I’ve been trying to clear or get around, unsuccessfully.
I wrote the code to examine command bar combo controls and transform the list index into a value in some other variable. Problem is that my command bar also has a button and the for loop crashes on it’s NEXT CTL statement. The error give is run time error 13 “Type mismatch”
I’ve wrestled trying to tell the loop to avoid anything but a combo box, but am unsuccessful thus far, any help is appreciated. The code below is my original problem function, I’ve gone through some other versions as well trying to get rid of the problem but no good so far.
'converts commandBar combo box listindex to a meaningful value...
Function convertListIndex()
Dim ctl As CommandBarComboBox
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
End Function