close a msgbox

close a msgbox

Post by » Sun, 20 Jun 2004 02:40:34


in my script i open a msgbox during a operation. How can i close it ? I've
try sendkeys "{enter}" but nothing happens

my code

MsgBox "hi",vbQuestion + vbOkOnly + vbApplicationModal + 0,"done"
wscript.sleep 200
wshshell.sendkeys "{enter}"

is ther a other solution to display a text on screen and close it.This
message is just a information in my script process

thanks for your help

nb : sorry for my bad english

close a msgbox

Post by R Dun » Sun, 20 Jun 2004 03:45:44

Use the popup method instead - you can set it to disappear after x amount of
time - here's the sample from the 5.6 Script Engine documentation:

Dim WshShell, BtnCode
Set WshShell = WScript.CreateObject("WScript.Shell")

BtnCode = WshShell.Popup("Do you feel alright?", 7, "Answer This Question:",
4 + 32)

Select Case BtnCode
case 6 WScript.Echo "Glad to hear you feel alright."
case 7 WScript.Echo "Hope you're feeling better soon."
case -1 WScript.Echo "Is there anybody out there?"
End Select

Run the script and let it sit. After 7 seconds, it will reply with "Is
anybody out there?" -

Hope this helps you,