View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Display MsgBox wait for 10 seconds then click on yes automatically


'----------------------------------------------------------------
Sub TimedMsgBox()
'----------------------------------------------------------------
Dim cTime As Long
Dim WSH As Object

Set WSH = CreateObject("WScript.Shell")
cTime = 20 ' 20 secs
Select Case WSH.Popup("Open an Excel file?!", cTime, "Question",
vbYesNo)
Case vbOK
MsgBox "You clicked OK"
Case vbCancel
MsgBox "You clicked Cancel"
Case -1
MsgBox "Timed out"
Case Else
End Select
End SUb


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Vikram Dhemare" wrote in message
...
Hi,

I have set of codes wherein msgbox prompts with vbYesNo buttons

like:(MsgBox
"Would you like to Start Timer ?" vbYesNo + vbDefault,1)
The code doen't jump on next code line until the user press the Yes or No
button.
Here is the problem where i need help.

Is there any way if, the user does not respond for next 20 seconds or so,
the programme himselfs assumes that Yes button (true value) being pressed

&
continue or jump on the next line of code.

Thanks in advance.
--
Thanks,
Vikram P. Dhemare