Modeless userform doesn't show if called twice from a modal userform (HELP!)

Oliver Dewar

Board Regular
Joined
Apr 17, 2011
Messages
201
Hi All,

I have a bizarre occurrence!

I recently posted a thread here because I had a modeless userform (modeless1) which was activated from a modal userform (modal1) and when used, returned back to modal1 in a loop - the user could then call modeless1 again if more data needs to be processed and around we go.

The original problem was that modeless1 would only show once then fail to load on the second loop. Well, we overcame that with the following from the command button on modal1:

Code:
Dim modelessForm As Object
Set modelessForm = New modeless1
'then call the form
modeless1.Show False
this calls modeless1 over and over again no problems... except that now I've found a random instance (in a different sequence of forms) where modeless1 will show once or twice (?!) then half load blank before totally disappearing!

Each time I close modeless1 using unload me so it's not hidden.

Anyone got any other ideas how to call a fresh version of modeless1 each time? Or any other ideas?

Thanks a ton in advance!
 

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,169
This is a guess.

Try changing this...
Code:
modeless1.Show False
To this...
Code:
[COLOR="Red"]modelessForm[/COLOR].Show False
If that alone doesn't work, additionaly try setting modelessForm to nothing when you close the form.
Code:
Set modelessForm = Nothing
 

Oliver Dewar

Board Regular
Joined
Apr 17, 2011
Messages
201
Hi Alphafrog,

Thanks for your ideas. Unfortunately they didn't work.

I've found a workaround though. I simply return to a sheet devoted to being in the middle of this loop, as if it were a userform in the loop, and from that sheet there's a command button that calls modal1 if needed. This way whatever's going wrong is being reset after each loop and modeless1 appears every time.

Cheers!;)
 

Forum statistics

Threads
1,082,629
Messages
5,366,645
Members
400,908
Latest member
currong

Some videos you may like

This Week's Hot Topics

Top