ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code stops while Userform Shown (https://www.excelbanter.com/excel-programming/428218-code-stops-while-userform-shown.html)

ExcelMonkey

Code stops while Userform Shown
 
I have some code which shows a userform. While the form is shown I want to
run through a lenthy routine and periodocially update a label with status
strings. However, once the userform is shown, the code stops progressing. I
can only get the code to progress if I close the form. It almost as if I
have set break in the code on the first line after the Userform1.Show
statement. Any ideas?


Sub DoSomething()
Userform1.Show

Call DoSomethingElse

End Sub

Call DoSomethingElse
Userform1.Label1 = "Show something"
End Sub

Thanks

EM

ExcelMonkey

Code stops while Userform Shown
 
Duh. Needed to ste ShowModal = False to make modeless.

Thanks

EM

"ExcelMonkey" wrote:

I have some code which shows a userform. While the form is shown I want to
run through a lenthy routine and periodocially update a label with status
strings. However, once the userform is shown, the code stops progressing. I
can only get the code to progress if I close the form. It almost as if I
have set break in the code on the first line after the Userform1.Show
statement. Any ideas?


Sub DoSomething()
Userform1.Show

Call DoSomethingElse

End Sub

Call DoSomethingElse
Userform1.Label1 = "Show something"
End Sub

Thanks

EM


Rick Rothstein

Code stops while Userform Shown
 
The way to do that and make your code self-documenting is to use the
built-in VB constant...

Userform1.Show vbModeless

--
Rick (MVP - Excel)


"ExcelMonkey" wrote in message
...
Duh. Needed to ste ShowModal = False to make modeless.

Thanks

EM

"ExcelMonkey" wrote:

I have some code which shows a userform. While the form is shown I want
to
run through a lenthy routine and periodocially update a label with status
strings. However, once the userform is shown, the code stops
progressing. I
can only get the code to progress if I close the form. It almost as if I
have set break in the code on the first line after the Userform1.Show
statement. Any ideas?


Sub DoSomething()
Userform1.Show

Call DoSomethingElse

End Sub

Call DoSomethingElse
Userform1.Label1 = "Show something"
End Sub

Thanks

EM




All times are GMT +1. The time now is 05:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com