Can someone tell me why this doesn't work?
Sub mySub(cbSelected as Commandbar)
    Dim cb as Commandbar

    For Each cb in Application.CommandBars
        If cb is cbSelected Then
            'code                             'Never gets here
        End If
    Next cb
End Sub
but this does work
Sub mySub(cbSelected as Commandbar)
    Dim sName as String
    Dim cb as Commandbar
    Dim s as String
  
    sName = cbSelected.Name
    For Each cb in Application.CommandBars
        s = cb.Name
        If s = sName Then
            'code
        End If
    Next cb
End Sub