开发者

MsgBox made with wscript.shell won't close automatically in this case

开发者 https://www.devze.com 2023-03-18 00:36 出处:网络
I am writing an .mdb file in ms-access, and with a form inside. I\'ve made a Subroutine to show a msgbox which will close automatically after some secs.

I am writing an .mdb file in ms-access, and with a form inside.

I've made a Subroutine to show a msgbox which will close automatically after some secs.

Sub TimedMsgBox(Message As String)

CreateObject("wscript.shell").PopUp _
        Message & vbCrLf & vbCrLf & _
        "This message self-closes in 2 seconds...", 2, "Message"

End Sub

When the msgbox popup, I wait and it close automatically, however, if I change my focus to other application such as firefox, the message开发者_StackOverflow中文版 will just wait for my attention and didn't close after the selected seconds.(i.e: it is not counting the seconds.) When I change my focus back to it, then it will count the seconds then exit.

How can I made it automatically disappear after some seconds no matter what I am doing?


If it is possible my suggestion would be to create a form instead of a msgbox. Then you can use the On Timer event on the form to automatically close after a period of time.

In my database I have a mainform that gets loaded by the users but when that form opens, I also open a hidden 'ExitForm'. This exit form has a timer event that closes the database at a certain time of night.

You might be able to do something similar.

0

精彩评论

暂无评论...
验证码 换一张
取 消