Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unsuccessful FOR NEXT loop (97)

    Unsuccessful FOR NEXT loop
    I

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Unsuccessful FOR NEXT loop (97)

    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

  3. #3
    Star Lounger
    Join Date
    Nov 2001
    Location
    Illinois, USA
    Posts
    60
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Unsuccessful FOR NEXT loop (97)

    Can you use the TypeName function here?
    For each ctl.....
    If TypeName(ctl) = "ComboBox" then....

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Unsuccessful FOR NEXT loop (97)

    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

  5. #5
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Unsuccessful FOR NEXT loop (97)

    Well, your suggestion 1 seems to be working!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •