Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Display MsgBox wait for 10 seconds then click on yes automatically

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Display MsgBox wait for 10 seconds then click on yes automatic

Hello Mr. Bob,

Thanks for your early response. My programming language is not good enough.
I have tried with the codes supplied by you but not getting the desired
answer.
The codes in my programming are given below. Could you help me to solve this.

'my codes
ws1.Range("A6").Value _
= "Last Run : " & Format(Now(), "ddd, dd/mm/yyyy hh:mm:ss AM/PM")

response = MsgBox("Do you want to Start Timer ?", vbYesNo + vbDefaultButton,
1)
'if here the user does not respond for 10 sec, then the programme sould
assume the response vbYes, & then start the next procedure. Is it possible?
If response = vbYes Then
StartTimer
End If
If response = vbNo Then
StopTimer
End If

-----------------------------------------------------------------------------------------------
Start Timer & Stop Timer is another procedures. like:
Sub StartTimer()
Dim ws1 As Worksheet
Set ws1 = ThisWorkbook.Worksheets("Summery")
'RunWhen = DateSerial(2006, 7, cRunIntervalDates)
'RunWhen = Now + TimeSerial(0, ws1.Range("E4"), 0)
RunWhen = Now + TimeSerial(0, 0, cRunIntervalTime * ws1.Range("E5"))
Application.OnTime earliesttime:=RunWhen, procedu=cRunWhat, _
schedule:=True
End Sub
Sub StopTimer()
On Error Resume Next
Application.OnTime earliesttime:=RunWhen, _
procedu=cRunWhat, schedule:=False
End Sub
--
Thanks,
Vikram P. Dhemare


"Bob Phillips" wrote:


'----------------------------------------------------------------
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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Display MsgBox wait for 10 seconds then click on yes automatic

It won't work if you don't use the code supplied, normal MsgBox doesn't time
out.

Dim RunWhen As Double

Sub Vikram()
Const TIMED_OUT As Long = -1
'my codes
ws1.Range("A6").Value _
= "Last Run : " & Format(Now(), "ddd, dd/mm/yyyy hh:mm:ss
AM/PM")

response = TimedMsgBox("Do you want to Start Timer ?", "AppTitle", 20)
If response = vbYes Or response = TIMED_OUT Then
StartTimer
Else
StopTimer
End If

End Sub

Sub StartTimer()
Dim ws1 As Worksheet
Set ws1 = ThisWorkbook.Worksheets("Summery")
'RunWhen = DateSerial(2006, 7, cRunIntervalDates)
'RunWhen = Now + TimeSerial(0, ws1.Range("E4"), 0)
RunWhen = Now + TimeSerial(0, 0, cRunIntervalTime * ws1.Range("E5"))
Application.OnTime earliesttime:=RunWhen, procedu=cRunWhat, _
schedule:=True
End Sub
Sub StopTimer()
On Error Resume Next
Application.OnTime earliesttime:=RunWhen, _
procedu=cRunWhat, schedule:=False
End Sub

'----------------------------------------------------------------
Function TimedMsgBox(Msg As String, _
Title As String, _
Duration As Long) As Long
'----------------------------------------------------------------
Dim cTime As Long
Dim WSH As Object

Set WSH = CreateObject("WScript.Shell")
TimedMsgBox = WSH.Popup("Open an Excel file?!", Duration, "Question",
vbYesNo)
End Function




--
HTH

Bob Phillips

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

"Vikram Dhemare" wrote in message
...
Hello Mr. Bob,

Thanks for your early response. My programming language is not good

enough.
I have tried with the codes supplied by you but not getting the desired
answer.
The codes in my programming are given below. Could you help me to solve

this.

'my codes
ws1.Range("A6").Value _
= "Last Run : " & Format(Now(), "ddd, dd/mm/yyyy hh:mm:ss AM/PM")

response = MsgBox("Do you want to Start Timer ?", vbYesNo +

vbDefaultButton,
1)
'if here the user does not respond for 10 sec, then the programme sould
assume the response vbYes, & then start the next procedure. Is it

possible?
If response = vbYes Then
StartTimer
End If
If response = vbNo Then
StopTimer
End If

--------------------------------------------------------------------------

---------------------
Start Timer & Stop Timer is another procedures. like:
Sub StartTimer()
Dim ws1 As Worksheet
Set ws1 = ThisWorkbook.Worksheets("Summery")
'RunWhen = DateSerial(2006, 7, cRunIntervalDates)
'RunWhen = Now + TimeSerial(0, ws1.Range("E4"), 0)
RunWhen = Now + TimeSerial(0, 0, cRunIntervalTime * ws1.Range("E5"))
Application.OnTime earliesttime:=RunWhen, procedu=cRunWhat, _
schedule:=True
End Sub
Sub StopTimer()
On Error Resume Next
Application.OnTime earliesttime:=RunWhen, _
procedu=cRunWhat, schedule:=False
End Sub
--
Thanks,
Vikram P. Dhemare


"Bob Phillips" wrote:


'----------------------------------------------------------------
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






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Display MsgBox wait for 10 seconds then click on yes automatic

Hello Mr. Bob,

Its not working. I think I am doing it wrongly.
The Programme doen't jump on next line unless & until the user press the Yes
or No Button.
What I want is, if the user does not respond within next 10 secs (after
displaying the TimedMsgBox) (as you said if response is TIMED_OUT) then the
programme should jump on next code line.

--
Thanks,
Vikram P. Dhemare


"Bob Phillips" wrote:

It won't work if you don't use the code supplied, normal MsgBox doesn't time
out.

Dim RunWhen As Double

Sub Vikram()
Const TIMED_OUT As Long = -1
'my codes
ws1.Range("A6").Value _
= "Last Run : " & Format(Now(), "ddd, dd/mm/yyyy hh:mm:ss
AM/PM")

response = TimedMsgBox("Do you want to Start Timer ?", "AppTitle", 20)
If response = vbYes Or response = TIMED_OUT Then
StartTimer
Else
StopTimer
End If

End Sub

Sub StartTimer()
Dim ws1 As Worksheet
Set ws1 = ThisWorkbook.Worksheets("Summery")
'RunWhen = DateSerial(2006, 7, cRunIntervalDates)
'RunWhen = Now + TimeSerial(0, ws1.Range("E4"), 0)
RunWhen = Now + TimeSerial(0, 0, cRunIntervalTime * ws1.Range("E5"))
Application.OnTime earliesttime:=RunWhen, procedu=cRunWhat, _
schedule:=True
End Sub
Sub StopTimer()
On Error Resume Next
Application.OnTime earliesttime:=RunWhen, _
procedu=cRunWhat, schedule:=False
End Sub

'----------------------------------------------------------------
Function TimedMsgBox(Msg As String, _
Title As String, _
Duration As Long) As Long
'----------------------------------------------------------------
Dim cTime As Long
Dim WSH As Object

Set WSH = CreateObject("WScript.Shell")
TimedMsgBox = WSH.Popup("Open an Excel file?!", Duration, "Question",
vbYesNo)
End Function




--
HTH

Bob Phillips

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

"Vikram Dhemare" wrote in message
...
Hello Mr. Bob,

Thanks for your early response. My programming language is not good

enough.
I have tried with the codes supplied by you but not getting the desired
answer.
The codes in my programming are given below. Could you help me to solve

this.

'my codes
ws1.Range("A6").Value _
= "Last Run : " & Format(Now(), "ddd, dd/mm/yyyy hh:mm:ss AM/PM")

response = MsgBox("Do you want to Start Timer ?", vbYesNo +

vbDefaultButton,
1)
'if here the user does not respond for 10 sec, then the programme sould
assume the response vbYes, & then start the next procedure. Is it

possible?
If response = vbYes Then
StartTimer
End If
If response = vbNo Then
StopTimer
End If

--------------------------------------------------------------------------

---------------------
Start Timer & Stop Timer is another procedures. like:
Sub StartTimer()
Dim ws1 As Worksheet
Set ws1 = ThisWorkbook.Worksheets("Summery")
'RunWhen = DateSerial(2006, 7, cRunIntervalDates)
'RunWhen = Now + TimeSerial(0, ws1.Range("E4"), 0)
RunWhen = Now + TimeSerial(0, 0, cRunIntervalTime * ws1.Range("E5"))
Application.OnTime earliesttime:=RunWhen, procedu=cRunWhat, _
schedule:=True
End Sub
Sub StopTimer()
On Error Resume Next
Application.OnTime earliesttime:=RunWhen, _
procedu=cRunWhat, schedule:=False
End Sub
--
Thanks,
Vikram P. Dhemare


"Bob Phillips" wrote:


'----------------------------------------------------------------
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








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Display MsgBox wait for 10 seconds then click on yes automatic

Works for me. Don't forget 20 secs is a long time to wait.

Try reducing it to 5 secs and see if it works, then gradually increase.

--
HTH

Bob Phillips

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

"Vikram Dhemare" wrote in message
...
Hello Mr. Bob,

Its not working. I think I am doing it wrongly.
The Programme doen't jump on next line unless & until the user press the

Yes
or No Button.
What I want is, if the user does not respond within next 10 secs (after
displaying the TimedMsgBox) (as you said if response is TIMED_OUT) then

the
programme should jump on next code line.

--
Thanks,
Vikram P. Dhemare


"Bob Phillips" wrote:

It won't work if you don't use the code supplied, normal MsgBox doesn't

time
out.

Dim RunWhen As Double

Sub Vikram()
Const TIMED_OUT As Long = -1
'my codes
ws1.Range("A6").Value _
= "Last Run : " & Format(Now(), "ddd, dd/mm/yyyy hh:mm:ss
AM/PM")

response = TimedMsgBox("Do you want to Start Timer ?", "AppTitle",

20)
If response = vbYes Or response = TIMED_OUT Then
StartTimer
Else
StopTimer
End If

End Sub

Sub StartTimer()
Dim ws1 As Worksheet
Set ws1 = ThisWorkbook.Worksheets("Summery")
'RunWhen = DateSerial(2006, 7, cRunIntervalDates)
'RunWhen = Now + TimeSerial(0, ws1.Range("E4"), 0)
RunWhen = Now + TimeSerial(0, 0, cRunIntervalTime * ws1.Range("E5"))
Application.OnTime earliesttime:=RunWhen, procedu=cRunWhat, _
schedule:=True
End Sub
Sub StopTimer()
On Error Resume Next
Application.OnTime earliesttime:=RunWhen, _
procedu=cRunWhat, schedule:=False
End Sub

'----------------------------------------------------------------
Function TimedMsgBox(Msg As String, _
Title As String, _
Duration As Long) As Long
'----------------------------------------------------------------
Dim cTime As Long
Dim WSH As Object

Set WSH = CreateObject("WScript.Shell")
TimedMsgBox = WSH.Popup("Open an Excel file?!", Duration,

"Question",
vbYesNo)
End Function




--
HTH

Bob Phillips

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

"Vikram Dhemare" wrote in message
...
Hello Mr. Bob,

Thanks for your early response. My programming language is not good

enough.
I have tried with the codes supplied by you but not getting the

desired
answer.
The codes in my programming are given below. Could you help me to

solve
this.

'my codes
ws1.Range("A6").Value _
= "Last Run : " & Format(Now(), "ddd, dd/mm/yyyy hh:mm:ss

AM/PM")

response = MsgBox("Do you want to Start Timer ?", vbYesNo +

vbDefaultButton,
1)
'if here the user does not respond for 10 sec, then the programme

sould
assume the response vbYes, & then start the next procedure. Is it

possible?
If response = vbYes Then
StartTimer
End If
If response = vbNo Then
StopTimer
End If


--------------------------------------------------------------------------
---------------------
Start Timer & Stop Timer is another procedures. like:
Sub StartTimer()
Dim ws1 As Worksheet
Set ws1 = ThisWorkbook.Worksheets("Summery")
'RunWhen = DateSerial(2006, 7, cRunIntervalDates)
'RunWhen = Now + TimeSerial(0, ws1.Range("E4"), 0)
RunWhen = Now + TimeSerial(0, 0, cRunIntervalTime * ws1.Range("E5"))
Application.OnTime earliesttime:=RunWhen, procedu=cRunWhat, _
schedule:=True
End Sub
Sub StopTimer()
On Error Resume Next
Application.OnTime earliesttime:=RunWhen, _
procedu=cRunWhat, schedule:=False
End Sub
--
Thanks,
Vikram P. Dhemare


"Bob Phillips" wrote:


'----------------------------------------------------------------
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








  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default Display MsgBox wait for 10 seconds then click on yes automatic

Hi Mr. Bob

I have tried but still the msgbox doesn't disappear after certain time. I am
doing it wrong. Plz. help me out.

--
Thanks,
Vikram P. Dhemare


"Bob Phillips" wrote:

Works for me. Don't forget 20 secs is a long time to wait.

Try reducing it to 5 secs and see if it works, then gradually increase.

--
HTH

Bob Phillips

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

"Vikram Dhemare" wrote in message
...
Hello Mr. Bob,

Its not working. I think I am doing it wrongly.
The Programme doen't jump on next line unless & until the user press the

Yes
or No Button.
What I want is, if the user does not respond within next 10 secs (after
displaying the TimedMsgBox) (as you said if response is TIMED_OUT) then

the
programme should jump on next code line.

--
Thanks,
Vikram P. Dhemare


"Bob Phillips" wrote:

It won't work if you don't use the code supplied, normal MsgBox doesn't

time
out.

Dim RunWhen As Double

Sub Vikram()
Const TIMED_OUT As Long = -1
'my codes
ws1.Range("A6").Value _
= "Last Run : " & Format(Now(), "ddd, dd/mm/yyyy hh:mm:ss
AM/PM")

response = TimedMsgBox("Do you want to Start Timer ?", "AppTitle",

20)
If response = vbYes Or response = TIMED_OUT Then
StartTimer
Else
StopTimer
End If

End Sub

Sub StartTimer()
Dim ws1 As Worksheet
Set ws1 = ThisWorkbook.Worksheets("Summery")
'RunWhen = DateSerial(2006, 7, cRunIntervalDates)
'RunWhen = Now + TimeSerial(0, ws1.Range("E4"), 0)
RunWhen = Now + TimeSerial(0, 0, cRunIntervalTime * ws1.Range("E5"))
Application.OnTime earliesttime:=RunWhen, procedu=cRunWhat, _
schedule:=True
End Sub
Sub StopTimer()
On Error Resume Next
Application.OnTime earliesttime:=RunWhen, _
procedu=cRunWhat, schedule:=False
End Sub

'----------------------------------------------------------------
Function TimedMsgBox(Msg As String, _
Title As String, _
Duration As Long) As Long
'----------------------------------------------------------------
Dim cTime As Long
Dim WSH As Object

Set WSH = CreateObject("WScript.Shell")
TimedMsgBox = WSH.Popup("Open an Excel file?!", Duration,

"Question",
vbYesNo)
End Function




--
HTH

Bob Phillips

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

"Vikram Dhemare" wrote in message
...
Hello Mr. Bob,

Thanks for your early response. My programming language is not good
enough.
I have tried with the codes supplied by you but not getting the

desired
answer.
The codes in my programming are given below. Could you help me to

solve
this.

'my codes
ws1.Range("A6").Value _
= "Last Run : " & Format(Now(), "ddd, dd/mm/yyyy hh:mm:ss

AM/PM")

response = MsgBox("Do you want to Start Timer ?", vbYesNo +
vbDefaultButton,
1)
'if here the user does not respond for 10 sec, then the programme

sould
assume the response vbYes, & then start the next procedure. Is it
possible?
If response = vbYes Then
StartTimer
End If
If response = vbNo Then
StopTimer
End If


--------------------------------------------------------------------------
---------------------
Start Timer & Stop Timer is another procedures. like:
Sub StartTimer()
Dim ws1 As Worksheet
Set ws1 = ThisWorkbook.Worksheets("Summery")
'RunWhen = DateSerial(2006, 7, cRunIntervalDates)
'RunWhen = Now + TimeSerial(0, ws1.Range("E4"), 0)
RunWhen = Now + TimeSerial(0, 0, cRunIntervalTime * ws1.Range("E5"))
Application.OnTime earliesttime:=RunWhen, procedu=cRunWhat, _
schedule:=True
End Sub
Sub StopTimer()
On Error Resume Next
Application.OnTime earliesttime:=RunWhen, _
procedu=cRunWhat, schedule:=False
End Sub
--
Thanks,
Vikram P. Dhemare


"Bob Phillips" wrote:


'----------------------------------------------------------------
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









  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Display MsgBox wait for 10 seconds then click on yes automatic

Sorry, no other ideas, it works fine for me.

--
HTH

Bob Phillips

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

"Vikram Dhemare" wrote in message
...
Hi Mr. Bob

I have tried but still the msgbox doesn't disappear after certain time. I

am
doing it wrong. Plz. help me out.

--
Thanks,
Vikram P. Dhemare


"Bob Phillips" wrote:

Works for me. Don't forget 20 secs is a long time to wait.

Try reducing it to 5 secs and see if it works, then gradually increase.

--
HTH

Bob Phillips

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

"Vikram Dhemare" wrote in message
...
Hello Mr. Bob,

Its not working. I think I am doing it wrongly.
The Programme doen't jump on next line unless & until the user press

the
Yes
or No Button.
What I want is, if the user does not respond within next 10 secs

(after
displaying the TimedMsgBox) (as you said if response is TIMED_OUT)

then
the
programme should jump on next code line.

--
Thanks,
Vikram P. Dhemare


"Bob Phillips" wrote:

It won't work if you don't use the code supplied, normal MsgBox

doesn't
time
out.

Dim RunWhen As Double

Sub Vikram()
Const TIMED_OUT As Long = -1
'my codes
ws1.Range("A6").Value _
= "Last Run : " & Format(Now(), "ddd, dd/mm/yyyy

hh:mm:ss
AM/PM")

response = TimedMsgBox("Do you want to Start Timer ?",

"AppTitle",
20)
If response = vbYes Or response = TIMED_OUT Then
StartTimer
Else
StopTimer
End If

End Sub

Sub StartTimer()
Dim ws1 As Worksheet
Set ws1 = ThisWorkbook.Worksheets("Summery")
'RunWhen = DateSerial(2006, 7, cRunIntervalDates)
'RunWhen = Now + TimeSerial(0, ws1.Range("E4"), 0)
RunWhen = Now + TimeSerial(0, 0, cRunIntervalTime *

ws1.Range("E5"))
Application.OnTime earliesttime:=RunWhen, procedu=cRunWhat, _
schedule:=True
End Sub
Sub StopTimer()
On Error Resume Next
Application.OnTime earliesttime:=RunWhen, _
procedu=cRunWhat, schedule:=False
End Sub

'----------------------------------------------------------------
Function TimedMsgBox(Msg As String, _
Title As String, _
Duration As Long) As Long
'----------------------------------------------------------------
Dim cTime As Long
Dim WSH As Object

Set WSH = CreateObject("WScript.Shell")
TimedMsgBox = WSH.Popup("Open an Excel file?!", Duration,

"Question",
vbYesNo)
End Function




--
HTH

Bob Phillips

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

"Vikram Dhemare" wrote in message
...
Hello Mr. Bob,

Thanks for your early response. My programming language is not

good
enough.
I have tried with the codes supplied by you but not getting the

desired
answer.
The codes in my programming are given below. Could you help me to

solve
this.

'my codes
ws1.Range("A6").Value _
= "Last Run : " & Format(Now(), "ddd, dd/mm/yyyy hh:mm:ss

AM/PM")

response = MsgBox("Do you want to Start Timer ?", vbYesNo +
vbDefaultButton,
1)
'if here the user does not respond for 10 sec, then the programme

sould
assume the response vbYes, & then start the next procedure. Is it
possible?
If response = vbYes Then
StartTimer
End If
If response = vbNo Then
StopTimer
End If



--------------------------------------------------------------------------
---------------------
Start Timer & Stop Timer is another procedures. like:
Sub StartTimer()
Dim ws1 As Worksheet
Set ws1 = ThisWorkbook.Worksheets("Summery")
'RunWhen = DateSerial(2006, 7, cRunIntervalDates)
'RunWhen = Now + TimeSerial(0, ws1.Range("E4"), 0)
RunWhen = Now + TimeSerial(0, 0, cRunIntervalTime *

ws1.Range("E5"))
Application.OnTime earliesttime:=RunWhen, procedu=cRunWhat, _
schedule:=True
End Sub
Sub StopTimer()
On Error Resume Next
Application.OnTime earliesttime:=RunWhen, _
procedu=cRunWhat, schedule:=False
End Sub
--
Thanks,
Vikram P. Dhemare


"Bob Phillips" wrote:



'----------------------------------------------------------------
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











Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro wait 30 seconds then Complete the Macro Vick Excel Discussion (Misc queries) 2 June 2nd 08 08:04 PM
How to display remaining txt file which overflowed MsgBox display? EagleOne Excel Discussion (Misc queries) 1 November 2nd 06 01:10 PM
how do you display a wait message while WANNABE Excel Programming 7 October 6th 06 05:10 AM
Displaying A MsgBox for X Seconds Mark Excel Programming 1 July 15th 05 02:41 PM
Wait for user to change data after msgbox ???? CanadianTrev Excel Discussion (Misc queries) 1 June 18th 05 08:27 PM


All times are GMT +1. The time now is 10:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"