1
votes

Is there a way to make a msgbox show and disappear in under a second,I have been using the script below, but can only get it to close in a second.

Option Explicit Dim Wshell, BtnCode Set Wshell = CreateObject("wscript.shell")

BtnCode= Wshell.Popup ("test", 1, "testing")

1

1 Answers

1
votes

I'm afraid this is not possible with popup. You can do it with Internet Explorer as UI though.

Set oIE = CreateObject("InternetExplorer.Application") 

With oIE 
  .navigate("about:blank") 
  .Document.Title = "Countdown" & string(100, chrb(160)) 
  .resizable=0 
  .height=200 
  .width=100 
  .menubar=0 
  .toolbar=0 
  .statusBar=0 
  .visible=1 
End With 

' wait for page to load 
Do while oIE.Busy 
  wscript.sleep 50 
Loop 

' prepare document body 
oIE.document.body.innerHTML = "<div id=""countdown"" style=""font: 36pt sans-serif;text-align:center;""></div>" 
oIE.document.all.countdown.innerText= "test message"
'the parameters is in miliseconds, so here the message is shown for half a second
wscript.sleep 500
oIE.quit