哈哈  我想通了 Private Sub Command1_Click()
MsgBox "哈哈哈哈哈"
End SubPrivate Sub Command1_KeyPress(KeyAscii As Integer)
Call Command1_Click
End Sub

解决方案 »

  1.   

    Private Sub Command1_Click()
    MsgBox "哈哈哈哈哈"
    End SubPrivate Sub Command1_KeyPress(KeyAscii As Integer)
    Call Command1_Click
    End Sub
    这么搞无论哪个键都响应  我晕  我只要  回车  响应啊  
    哥哥姐姐 帮帮忙啦  知道你们是后现代雷峰
      

  2.   

    if KeyAscii = &H0D then
      Call Command1_Click
    End If
      

  3.   

    呵呵 终于来了 
    &hod  就是回车的ascii马吗?
    可以在command1的属性里面设置吗
      

  4.   

    ysf1980() 哥哥
      我试过了 呀 
    可是 那个   &  符号好象有问题
    说什么   缺少表达式
      

  5.   

    gzj0815(wy) 哥哥  的方法可行,你接好了咯
      

  6.   

    Private Sub 对象_KeyPress(KeyAscii As Integer)if KeyAscii = 13 then
      事件代码
    End If
    End Sub
      

  7.   

    xiaoweiwei1976(小卫卫)  GG的 方法也行不通呀 ?我又困惑啦
      

  8.   

    KeyAscii = 13 或VBRETURN
      

  9.   

    Private Sub Command1_KeyPress(KeyAscii As Integer)
       if keyascii=13 then msgbox "程序就是这样写的!"
    End Sub不过要先让Command1得到焦点。可设其属性Tabindex的值为0