Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: Programatically stop macro

  1. #1
    New Member
    Join Date
    Mar 2002
    Posts
    49
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi guys..
    Say I have a macro XX running... & I have a useform with a Stop Macro command button. How, if its possible, to stop XX using the cmdbutton_click() event handler??

  2. #2
    Board Regular
    Join Date
    Mar 2002
    Location
    =ActiveCell.Address
    Posts
    478
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Would something like this do the trick?


    Private Sub CancelButton1_Click()
    Userform1.Hide
    End
    End Sub

    Rgds
    AJ

  3. #3
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    End can be dangerous.
    To stop a seperate process, use a Global flag. Place a line in such as this...
    If ExitNow Then Exit Sub
    Assign the boolean ExitNow as True with your commandbutton.
    Tom

  4. #4
    New Member
    Join Date
    Mar 2002
    Posts
    49
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Gotcha... thanks... so basically I will modify XX to check the global variable upon entry, exit or mid-way or something right??

  5. #5
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Correct
    Dim Public in standard mod

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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