Thank you for your reply. But I'm afraid I don't understand very well. You use "class", and I don't have any special classes?? All I have is the two forms.
The main code in Private Sub CommandButton1_Click() in frmMain does not contain any loops. It just begins and runs through until the end. My thought is to call a separate form (frmWaiting) that has a looping "action" indicator (as opposed to a "progress" indicator, because this isn't intended to show any specific amount of progress, just that action is happening). I am unclear about DoEvents and where it needs to be placed to allow this to happen - if it's even possible for this to happen. If I have in frmMain: CommandButton1_Click() frmWaiting.Open vbModeless DoEvents <rest of macro> won't the code hit the Open command, open the form and begin executing that loop, and never drop into the DoEvents and run the rest of the macro? I guess I'm actually trying to see if I can get two separate macros to run at the same time: my main code in one form, and the looping code in the second form. Am I trying to do the impossible? Ed On Oct 20, 4:13 am, roberto mensa <robb....@gmail.com> wrote: > try this soluction: > > 'in the class moduleuserform2 > 'showmodale=false > > Private Sub CommandButton1_Click() > Dim d > d = Now > UserForm1.Show vbModeless > 'your code > 'for example > Do > Loop Until Now > (d + TimeValue("00:00:10")) > > Unload UserForm1 > End Sub > > 'in the class moduleuserform1 > Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) > If CloseMode = vbFormControlMenu Then > Cancel = True > End If > End Sub > > regards > r > > https://sites.google.com/site/e90e50/user/excel-grafico-semaforo > 2010/10/20 Ed from AZ <prof_ofw...@yahoo.com> > > > > > 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 > > (XL2007, Vista Pro) > > > -- > > > ---------------------------------------------------------------------------------- > > Some important links for excel users: > > 1. Follow us on TWITTER for tips tricks and links : > >http://twitter.com/exceldailytip > > 2. Join our LinkedIN group @http://www.linkedin.com/groups?gid=1871310 > > 3. Excel tutorials athttp://www.excel-macros.blogspot.com > > 4. Learn VBA Macros athttp://www.quickvba.blogspot.com > > 5. Excel Tips and Tricks athttp://exceldailytip.blogspot.com > > > To post to this group, send email to excel-macros@googlegroups.com > > > <><><><><><><><><><><><><><><><><><><><><><> > > Like our page on facebook , Just follow below link > >http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&...- > >Hide quoted text - > > - Show quoted text - -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&ref=ts