|
下拉列表选项循环,其他控件不获得焦点- Private Sub cbx_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
- Dim keys As Integer, i As Integer, cbxname As String
- keys = KeyCode: i = cbx.ListCount
- If cbx.Value = cbx.List(0) And keys = 38 Then
- cbx.Value = cbx.List(i - 1): KeyCode = 0
- ElseIf cbx.Value = cbx.List(i - 1) And keys = 40 Then
- cbx.Value = cbx.List(0): KeyCode = 0
- End If
- keys = 0
- End Sub
复制代码 下拉列表到顶端、底端停留,其他控件不获得焦点
- Private Sub cbx_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
- Dim keys As Integer, i As Integer, cbxname As String
- keys = KeyCode: i = cbx.ListCount
- If cbx.Value = cbx.List(0) And keys = 38 Then
- cbx.Value = cbx.List(0): KeyCode = 0
- ElseIf cbx.Value = cbx.List(i - 1) And keys = 40 Then
- cbx.Value = cbx.List(i - 1): KeyCode = 0
- End If
- keys = 0
- End Sub
复制代码
|
|