怎么不都不这样回答:必然是无助了才求助
'函数申明
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal Scan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Const KEYEVENTF_KEYUP = &H2 '释放按键常数
Private Sub Command1_Click()
'模拟键盘操作,一个完整的键盘点击包括按下和释放两个过程,F2对应键值是113
Call keybd_event(113, 0, 0, 0) '按下
End Sub
Private Sub Command2_Click()
Call keybd_event(113, 0, KEYEVENTF_KEYUP, 0) '释放
End Sub