Private Declare Function SetTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long, ByVal uElaspe As Long, ByVal lpTimerFunc As Long) As Long Private Declare Function KillTimer Lib "user32" (ByVal hwnd As Long, ByVal nIDEvent As Long) As Long Private id As Long Sub mgb() id = SetTimer(0&, 0&, 1000&, AddressOf Clme) MsgBox ("1秒后自动关闭") KillTimer 0&, id End Sub Sub Clme() SendKeys "{enter}" End Sub