View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Carl Willems Carl Willems is offline
external usenet poster
 
Posts: 4
Default Help with DoEvents to show progress form, please?

Hi,

this won't work that way. What you can do is put the long running code in a
separate Sub or Function and when you open the second form, have that form
call the code in the separate Sub. Inside the separate sub, you then need
to add the code to change the color in you second form.

Sounds more complicated than it actually is.

rgds,
Carl

Ed from AZ wrote in news:48ac5d93-0de6-4031-b1e4-
:

I've got a pretty long-running macro inside a UserForm, and I wanted
to open a second form just to show that things are still working and
not crashed. It's pretty simple - four labels and I cycle around
turning one at a time a different color.

I call it from the main form with
Private Sub CommandButton1_Click()

DoEvents
frmWaiting.Show vbModeless
DoEvents

Unfortunately, once the code drops into the second form, the main code
in the first form never executes.

I thought DoEvents was supposed to let the running code "drop through"
to allow both forms to run their code. Obviously, I'm very
incorrect!! 8(

How can I make this happen correctly?
Ed