把这个按钮的defalt属性设置为true
Private Sub Command1_Click() MsgBox "123"End SubPrivate Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Command1_ClickEnd SubPrivate Sub Form_Load() Me.KeyPreview = TrueEnd Sub