unload userform problem

L

leonidas

Hi,

I have some userforms and some code to get those userforms to work.
In a few userforms I end the code like:


Code:
--------------------
...
Unload Me
UserForm3.show
--------------------


And when I push the CommandButton2 (=Cancel) on this UserForm3 the
previous userform is back again.

The only problem is that the "Unload Me" command doesn't work so well.
UserForm3 comes in front of the previous userform, but the previous
userform isn't really disappearing?
Does someone know what the problem is? Thanks in advance!
 
J

Jim Rech

"Me" doesn't unload until the code in "Me" is done running. I'd suggest the
you put UserForm3.show in a sub in a standard module and that you call that
sub with an OnTime macro:

Unload Me
Application.OnTime Now, "SubToShowUF3"


--
Jim
message |
| Hi,
|
| I have some userforms and some code to get those userforms to work.
| In a few userforms I end the code like:
|
|
| Code:
| --------------------
| ...
| Unload Me
| UserForm3.show
| --------------------
|
|
| And when I push the CommandButton2 (=Cancel) on this UserForm3 the
| previous userform is back again.
|
| The only problem is that the "Unload Me" command doesn't work so well.
| UserForm3 comes in front of the previous userform, but the previous
| userform isn't really disappearing?
| Does someone know what the problem is? Thanks in advance!
|
|
| --
| leonidas
| ------------------------------------------------------------------------
| leonidas's Profile:
http://www.excelforum.com/member.php?action=getinfo&userid=35375
| View this thread: http://www.excelforum.com/showthread.php?threadid=558400
|
 
L

leonidas

Hi Jim,

That solution worked for me! Thanks!
But I still have a problem with dragging those userforms (see
attachment).
Do you (or someone else) know how to solve that problem?
Thanks in advance!


+-------------------------------------------------------------------+
|Filename: Printscreen.jpg |
|Download: http://www.excelforum.com/attachment.php?postid=4979 |
+-------------------------------------------------------------------+
 
L

leonidas

Hi,

I have solved the problem with dragging userforms over the screen.
I used "Application.ScreenUpdating = False" and then the userfor
doesn't update too. By ending the macro wit
"Application.ScreenUpdating = True" the problem was solved
 

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