我正在尝试生成一个在给定时间后关闭的弹出窗口WaitTime
很快。
我咨询过this链接和this link.
我尝试应用“VBA Excel宏消息框自动关闭“;我的代码如下:
Sub TestSubroutine()
Dim TemporalBox As Integer
Dim WaitTime As Integer
Dim WScriptShell As Object
Set WScriptShell = CreateObject("WScript.Shell")
WaitTime = 1
TemporalBox = WScriptShell.Popup("The message box will close in 1 second.", _
WaitTime, "File processed")
End Sub
弹出窗口已显示,但一秒钟后不会关闭。
Edit #1
根据@Skip Intro评论,我更新了代码:
Sub TestSubroutine()
Dim WaitTime As Integer
WaitTime = 1
CreateObject("WScript.Shell").Popup "The message box will close in 1 second.", _
WaitTime, "File processed"
End Sub
然而,这并没有解决最初的问题,弹出窗口在 1 秒后没有关闭。
Edit #2
这是@Glitch_Doctor 建议的代码,但它仍然不起作用:
Sub TestSubroutine()
Dim TemporalBox As Integer
Dim WaitTime As Integer
Dim WScriptShell As Object
Dim test
Set WScriptShell = CreateObject("WScript.Shell")
WaitTime = 1
Select Case TemporalBox = WScriptShell.Popup("The message box will close in 1 second.", _
WaitTime, "File processed")
Case 1, -1
End Select
End Sub