| Home | Forums | Reviews | Articles | Register |
![]() |
| Thread Tools | Rate Thread |
|
|
|
| |
|
Bob Phillips
Guest
Posts: n/a
|
'---------------------------------------------------------------- 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" <(E-Mail Removed)> wrote in message news:E0D9EDC9-4945-4819-B612-(E-Mail Removed)... > 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 |
|
||
|
||||
|
=?Utf-8?B?VmlrcmFtIERoZW1hcmU=?=
Guest
Posts: n/a
|
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, procedure:=cRunWhat, _ schedule:=True End Sub Sub StopTimer() On Error Resume Next Application.OnTime earliesttime:=RunWhen, _ procedure:=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" <(E-Mail Removed)> wrote in message > news:E0D9EDC9-4945-4819-B612-(E-Mail Removed)... > > 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 > > > |
|
||
|
||||
|
Bob Phillips
Guest
Posts: n/a
|
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, procedure:=cRunWhat, _ schedule:=True End Sub Sub StopTimer() On Error Resume Next Application.OnTime earliesttime:=RunWhen, _ procedure:=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" <(E-Mail Removed)> wrote in message news:7ACB596B-81D1-4887-BD50-(E-Mail Removed)... > 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, procedure:=cRunWhat, _ > schedule:=True > End Sub > Sub StopTimer() > On Error Resume Next > Application.OnTime earliesttime:=RunWhen, _ > procedure:=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" <(E-Mail Removed)> wrote in message > > news:E0D9EDC9-4945-4819-B612-(E-Mail Removed)... > > > 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 > > > > > > |
|
||
|
||||
|
=?Utf-8?B?VmlrcmFtIERoZW1hcmU=?=
Guest
Posts: n/a
|
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, procedure:=cRunWhat, _ > schedule:=True > End Sub > Sub StopTimer() > On Error Resume Next > Application.OnTime earliesttime:=RunWhen, _ > procedure:=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" <(E-Mail Removed)> wrote in message > news:7ACB596B-81D1-4887-BD50-(E-Mail Removed)... > > 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, procedure:=cRunWhat, _ > > schedule:=True > > End Sub > > Sub StopTimer() > > On Error Resume Next > > Application.OnTime earliesttime:=RunWhen, _ > > procedure:=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" <(E-Mail Removed)> wrote in message > > > news:E0D9EDC9-4945-4819-B612-(E-Mail Removed)... > > > > 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 > > > > > > > > > > > > |
|
||
|
||||
|
Bob Phillips
Guest
Posts: n/a
|
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" <(E-Mail Removed)> wrote in message news:93052AEB-0FFC-4092-B5CA-(E-Mail Removed)... > 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, procedure:=cRunWhat, _ > > schedule:=True > > End Sub > > Sub StopTimer() > > On Error Resume Next > > Application.OnTime earliesttime:=RunWhen, _ > > procedure:=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" <(E-Mail Removed)> wrote in message > > news:7ACB596B-81D1-4887-BD50-(E-Mail Removed)... > > > 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, procedure:=cRunWhat, _ > > > schedule:=True > > > End Sub > > > Sub StopTimer() > > > On Error Resume Next > > > Application.OnTime earliesttime:=RunWhen, _ > > > procedure:=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" <(E-Mail Removed)> wrote in message > > > > news:E0D9EDC9-4945-4819-B612-(E-Mail Removed)... > > > > > 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 > > > > > > > > > > > > > > > > > > |
|
||
|
||||
|
=?Utf-8?B?VmlrcmFtIERoZW1hcmU=?=
Guest
Posts: n/a
|
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" <(E-Mail Removed)> wrote in message > news:93052AEB-0FFC-4092-B5CA-(E-Mail Removed)... > > 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, procedure:=cRunWhat, _ > > > schedule:=True > > > End Sub > > > Sub StopTimer() > > > On Error Resume Next > > > Application.OnTime earliesttime:=RunWhen, _ > > > procedure:=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" <(E-Mail Removed)> wrote in message > > > news:7ACB596B-81D1-4887-BD50-(E-Mail Removed)... > > > > 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, procedure:=cRunWhat, _ > > > > schedule:=True > > > > End Sub > > > > Sub StopTimer() > > > > On Error Resume Next > > > > Application.OnTime earliesttime:=RunWhen, _ > > > > procedure:=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" <(E-Mail Removed)> wrote in message > > > > > news:E0D9EDC9-4945-4819-B612-(E-Mail Removed)... > > > > > > 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 > > > > > > > > > > > > > > > > > > > > > > > > > > > |
|
||
|
||||
|
Bob Phillips
Guest
Posts: n/a
|
Sorry, no other ideas, it works fine for me.
-- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Vikram Dhemare" <(E-Mail Removed)> wrote in message news:A1BC83DB-7F66-4773-8EF8-(E-Mail Removed)... > 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" <(E-Mail Removed)> wrote in message > > news:93052AEB-0FFC-4092-B5CA-(E-Mail Removed)... > > > 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, procedure:=cRunWhat, _ > > > > schedule:=True > > > > End Sub > > > > Sub StopTimer() > > > > On Error Resume Next > > > > Application.OnTime earliesttime:=RunWhen, _ > > > > procedure:=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" <(E-Mail Removed)> wrote in message > > > > news:7ACB596B-81D1-4887-BD50-(E-Mail Removed)... > > > > > 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, procedure:=cRunWhat, _ > > > > > schedule:=True > > > > > End Sub > > > > > Sub StopTimer() > > > > > On Error Resume Next > > > > > Application.OnTime earliesttime:=RunWhen, _ > > > > > procedure:=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" <(E-Mail Removed)> wrote in message > > > > > > news:E0D9EDC9-4945-4819-B612-(E-Mail Removed)... > > > > > > > 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 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
|
||
|
||||
|
|
|
| |
![]() |
| Thread Tools | |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| wait msgbox for 3 seconds only | Eddy Stan | Microsoft Excel Programming | 2 | 26th Nov 2008 06:58 PM |
| Any better way to wait 60 seconds | Tony WONG | Microsoft VB .NET | 6 | 6th Mar 2008 04:33 AM |
| wait for x seconds | tony | Microsoft Dot NET Compact Framework | 1 | 22nd Jul 2006 06:05 PM |
| How to display a simple please wait on button click | =?Utf-8?B?RTQzNTA5?= | Microsoft ASP .NET | 2 | 19th Mar 2004 10:02 AM |
| wait a few seconds | Snuyt | Microsoft VB .NET | 15 | 8th Feb 2004 10:13 PM |
Powered by vBulletin®. Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2010, Crawlability, Inc. |




