MSDN > Home page del forum > Visual Basic for Applications (VBA) > How to use ESC key to break the loop?
Formula una domandaFormula una domanda
 

Con rispostaHow to use ESC key to break the loop?

  • venerdì 3 luglio 2009 0.31AusJT Medaglie utenteMedaglie utenteMedaglie utenteMedaglie utenteMedaglie utente
     

    When ESC key press on 1st time, waitTime disable as graph just scroll without the delay.
    When ESC press the 2nd time, Error message "Code execution has been interrupted" > [Continue], [End], [Debug]   
    Would like when ESC key press, it will stop the Graph display loop and back to the UserForm.

    Do While jj < ii + 1
    Application.OnKey "{ESC}", "goto BreakHandler"
    Sheets(Graph(jj)).Select
    newHour = Hour(Now())
    newMinute = Minute(Now())
    newSecond = Second(Now()) + 5
    waitTime = TimeSerial(newHour, newMinute, newSecond)
    Application.Wait waitTime
    jj = jj + 1
    If jj >= ii Then jj = 1
    Loop

    • ModificatoAusJT giovedì 9 luglio 2009 1.40
    • ModificatoAusJT mercoledì 8 luglio 2009 23.19
    •  

Risposte

Tutte le risposte