1

Topic: How to restrict time for the answer in a dialog box (yes/is not present) vba

Hello. There is a dialog box, at pushing "yes" - passes to code performance, at pushing "is not present" - Exit sub

Dim xx
xx = MsgBox ("you are assured, what want to continue?", vbYesNo, "to continue?")
If xx = 6 Then: GoTo continue
If xx = 7 Then: Exit Sub

It would be desirable to restrict somehow time for the answer, and  to select "yes" through 15

2

Re: How to restrict time for the answer in a dialog box (yes/is not present) vba

Yes draw the MsgBox. The form the elementary to a triviality...

3

Re: How to restrict time for the answer in a dialog box (yes/is not present) vba

Alternative variant:

Dim AckTime As Integer, InfoBox As Object
Set InfoBox = CreateObject ("WScript. Shell")
AckTime = 15
If 7 = InfoBox. Popup ("you are assured, what want to continue?", AckTime, "" to continue? ", 4) Then
Exit Sub
End If

Pushing Yes returns 6, pushing No returns 7, in the absence of pushing returns-1.

4

Re: How to restrict time for the answer in a dialog box (yes/is not present) vba

Or in single line:

If 7 = CreateObject ("WScript. Shell").Popup ("you are assured, what want to continue?", 15, "to continue?", 4) Then Exit Sub

5

Re: How to restrict time for the answer in a dialog box (yes/is not present) vba

Akina;
Many thanks