sw1
sw1

Reputation: 33

Is there a way to get a MessageBox to automatically dismiss after a set interval of time?

I have a VBScript to alert on an event with a MessageBox, but I would like this to be automatically dismissed after 5 seconds or so. Is there a way to achieve this?

Upvotes: 3

Views: 13334

Answers (1)

Nilpo
Nilpo

Reputation: 4816

Use the WshShell Object's Popup method. It has a timeout parameter.

intTimeout = 10      'Number of seconds to wait
strMessage = "This is my message box!"
strTitle = "Hello, world!"

Set WshShell = CreateObject("WScript.Shell")
intResult = WshShell.Popup(strMessage, intTimeout, strTitle)

For more, check out my article Mastering the MessageBox on ASP Free. (archive)

Upvotes: 10

Related Questions