1个回答
展开全部
使用windows api中的MsgBoxEx函数,可以让消息框自动关闭:
Private Declare Function MsgBoxEx Lib "user32" Alias "MessageBoxTimeoutA" ( _
ByVal hwnd As Long, _
ByVal lpText As String, _
ByVal lpCaption As String, _
ByVal wType As VbMsgBoxStyle, _
ByVal wlange As Long, _
ByVal dwTimeout As Long) As Long
Private Sub TestMsgboxEx()
Dim ret As Long
ret = MsgBoxEx(0, "请选择", "两秒后自动关闭", vbYesNo + vbInformation, 1, 2000)
If ret = 32000 Then
Debug.Print "超时关闭"
ElseIf ret = vbYes Then
Debug.Print "选择Yes"
ElseIf ret = vbNo Then
Debug.Print "选择No"
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询