Display popup for a time period in Excel

前端 未结 5 1299
萌比男神i
萌比男神i 2021-01-23 17:41

I am trying to generate a popup that closes after a given WaitTime in seconds.

I consulted this link and this link.

I tried to apply the method from

5条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-23 18:42

    I finally found a very simple solution - credits to @Orphid, see his answer in the following thread.

    I did not solve the specific issue related to my original code, but I managed to create a PopUp that closes after a specified period of time. The code is the following:

    Sub subClosingPopUp(PauseTime As Integer, Message As String, Title As String)
    
    Dim WScriptShell As Object
    Dim ConfigString As String
    
    Set WScriptShell = CreateObject("WScript.Shell")
    ConfigString = "mshta.exe vbscript:close(CreateObject(""WScript.Shell"")." & _
                   "Popup(""" & Message & """," & PauseTime & ",""" & Title & """))"
    
    WScriptShell.Run ConfigString
    
    End Sub
    

    This works just fine.

提交回复
热议问题