Results 1 to 2 of 2

Thread: How to use command button

  1. #1
    astaro
    Guest

    Question How to use command button

    Hi everybody
    I would like to do this one:
    For example, i have a command button that will stop a loop.
    Do
    .......
    loop until command button is clicked
    How to encode this one ?
    Big thanks in advance and Happy New Year !

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    VB Code:
    1. Option Explicit
    2. Private StopIt As Boolean
    3.  
    4. Private Sub cmdCancel_Click()
    5. StopIt = True
    6. End Sub
    7.  
    8. Private Sub cmdDoTheLoop_Click()
    9.     Dim i As Long
    10.       For i = 1 to 1000000
    11.             'do your loop
    12.             DoEvents
    13.             If StopIt = True Then Exit For
    14.       Next
    15. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width