Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) MsgBox KeyCode End Sub试试看,ctrl是17所以,你在KeyDown事件里这样判断 if KeyCode=17 then .... end if
Dim iKeyCode As Integer Private Sub Command1_Click() If iKeyCode = 2 Then Debug.Print "Ctrl Be press!" End If End SubPrivate Sub Command1_KeyDown(KeyCode As Integer, Shift As Integer) iKeyCode = Shift End Sub
MsgBox KeyCode
End Sub试试看,ctrl是17所以,你在KeyDown事件里这样判断
if KeyCode=17 then
....
end if
Private Sub Command1_Click()
If iKeyCode = 2 Then
Debug.Print "Ctrl Be press!"
End If
End SubPrivate Sub Command1_KeyDown(KeyCode As Integer, Shift As Integer)
iKeyCode = Shift
End Sub