Microsoft Developer Network > 포럼 홈 > Visual Basic for Applications (VBA) > How to use ESC key to break the loop?
질문하기질문하기
 

답변됨How to use ESC key to break the loop?

  • 2009년 7월 3일 금요일 오전 12:31AusJT 사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     

    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

    • 편집됨AusJT 2009년 7월 9일 목요일 오전 1:40
    • 편집됨AusJT 2009년 7월 8일 수요일 오후 11:19
    •  

답변

모든 응답