Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing Excel UserForm causes Excel to not be the active application

Status
Not open for further replies.

jmcclen

Programmer
Sep 24, 2001
2
US
I've got a userform that when it unloads, it causes Excel to not be the active application, even if there is nothing else running on the desktop. I've tried activating a sheet before the unload, but it doesn't help. Any msgbox opened after the unload will exibit the same problem until the menu item processing is finished. I've got other userforms on this app that are nearly identical to the problem one that do not exhibit this behavior. What can cause Excel to lose focus? I've got a wrapper error routine that is not being called, plus the problem will not happen in debug mode, or if the VBA editor is just open.
Thanks for any assistance you can give.

 
Actually, I found a reason, but it makes no sense - apparently a UserForm can be called from a procedure, but NOT a procedure that was called. I have a menu item that calls SUB1, which in turn calls SUB2. If the form is called in SUB1 or SUB2, when the form unloads Excel is no longer the active application. If the form was called in the beginning procedure, then it works fine.
If anybody has any idea WHY this happens, I'd love to read it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top