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 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
>

-- 
----------------------------------------------------------------------------------
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

Reply via email to