当然可以通过变通的方法设置Option ExplicitPrivate Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyReturn Then Call Image1_Click End If End SubPrivate Sub Form_Load() Me.KeyPreview = True End SubPrivate Sub Image1_Click() MsgBox "image1 click" End Sub
If KeyCode = vbKeyReturn Then
Call Image1_Click
End If
End SubPrivate Sub Form_Load()
Me.KeyPreview = True
End SubPrivate Sub Image1_Click()
MsgBox "image1 click"
End Sub