且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在vbscript中自动关闭MsgBox?

更新时间:2023-09-18 11:19:46

我的评论为您提供了搜索和找出可行答案的提示.但是,为了节省您的时间,这里有一些见解.

My comment has provided you tips to search and find out feasible answers. However to save your time, here is some insights.

这是任何人都可以想到的 VBA ***方式.

Here is the best possible way anyone could think of in terms of VBA.

  1. 创建表单
  2. 将其用作 MSGBOX
  3. 添加计时器
  4. 给定一段时间(空闲)关闭表单.

--

  • 另一种方法 参考.这使用 Pop-Up 框作为 MSGBOX.
  • Another method Reference. This uses a Pop-Up box as the MSGBOX.

代码:

Sub Test1()
 Dim AckTime As Integer, InfoBox As Object

 Set InfoBox = CreateObject("WScript.Shell")
 AckTime = 3
 Select Case InfoBox.Popup("Click OK or do nothing within 3 seconds.", _
 AckTime, "This is your Message Box", 0)

 Case 1, -1
  Exit Sub
 End Select
End Sub