| Private Declare Function GetAsyncKeyState Lib "user32" _ (ByVal vKey As Long) As Integer '//ESCAPE Const VK_ESCAPE = &H1B '//Button Click Const VK_LBUTTON = &H1 '//Interrupting A Do Loop '//Give user ability to interrupt loop Private Sub cmdStart_Click() Do If GetAsyncKeyState(VK_ESCAPE) < 0 Or _ GetAsyncKeyState(VK_LBUTTON) < 0 Then Debug.Print "-------> EXIT <-------" Exit Do End If Debug.Print "______ LOOPING ___________" Loop End Sub Private Sub cmdExit_Click() Unload Me End Sub |
Interrupting A Do Loop |
Freelance ASP PHP web development | Web developer India Web development India| Prayagasoft - web designer India, Ecommerce developer india, Ecommerce design