View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Alex St-Pierre Alex St-Pierre is offline
external usenet poster
 
Posts: 169
Default How to stop macro with cancel button

It's not the doevents.. I don't know why but even if I remove the line, my
program break every 2 seconds.. it's very strange at any line. If I do a F8
or continue, it runs until the next stop.

--
Alex St-Pierre


"Bob Phillips" wrote:

Your code needs to give the form button press the chance to get a look in,
issuing DoEvents throughout the code that updates the progress bar. Beyond
that, we would need to see the code.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Alex St-Pierre" wrote in message
...
Hi !
When I click on form1 (execute button), I close form1 and open a form2
which
indicate a process bar and there is a Cancel button to stop the macro.
When I
click on it, the macro continue to run. Is there a way to stop the macro?
Thanks!!
Alex

'Userform1:
Private Sub CreateReport_Click()
UserForm1.Hide
UserForm2.Show
End
End Sub
'Userform2:
Private Sub UserForm_Activate()
Call MainMacro
Unload UserForm2
End Sub
Private Sub CommandButtonCancel_Click()
End 'doesn't work
End Sub
--
Alex St-Pierre