Help with DoEvents to show progress form, please?

E

Ed from AZ

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
 
C

Carl Willems

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top