ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hiding Userforms (https://www.excelbanter.com/excel-programming/316250-hiding-userforms.html)

CeeKay

Hiding Userforms
 
Often in some of the workbooks I've built, a modal userform will continue to
be visible even while the code processes. I'm trying to pin this down. Is
it due to where in the code I turn screenupdating off or where the ".hide"
statement appears? Or is it something else? I suspect I need to make sure
I "hide" the form before turning off screenupdating. Does where the "hide"
statement occurs have any bearing? IOW does that need to be in one of the
events of the form or in the main module?



Simon Lloyd[_607_]

Hiding Userforms
 

Hi,

Have you tried......Unload Userform1 in the Private Su
ComboBox1_Change() module or Userform1.Hide in the Private Su
CommandButton1_Click() module? or in the Private Sub TextBox1_Change(
module you could use Unload Me .

Hope these help!

Simon

--
Simon Lloy
-----------------------------------------------------------------------
Simon Lloyd's Profile: http://www.excelforum.com/member.php...nfo&userid=670
View this thread: http://www.excelforum.com/showthread.php?threadid=27682


Robin Hammond[_2_]

Hiding Userforms
 
Try DoEvents. e.g. in your form code:

Sub cmdOK_Click
Me.Hide
DoEvents
'rest of your code
Me.Show
End Sub

Robin Hammond
www.enhanceddatasystems.com

"CeeKay" wrote in message
om...
Often in some of the workbooks I've built, a modal userform will continue
to be visible even while the code processes. I'm trying to pin this down.
Is it due to where in the code I turn screenupdating off or where the
".hide" statement appears? Or is it something else? I suspect I need to
make sure I "hide" the form before turning off screenupdating. Does where
the "hide" statement occurs have any bearing? IOW does that need to be in
one of the events of the form or in the main module?





Bob Flanagan

Hiding Userforms
 
Try using
Application.screenupdating = true

to clear the image of the form. Then set to false with another statement to
hide screen activity. What you are seeing is a "ghost" image that Excel has
not had time to clear.

Robert Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"CeeKay" wrote in message
om...
Often in some of the workbooks I've built, a modal userform will continue

to
be visible even while the code processes. I'm trying to pin this down.

Is
it due to where in the code I turn screenupdating off or where the ".hide"
statement appears? Or is it something else? I suspect I need to make

sure
I "hide" the form before turning off screenupdating. Does where the

"hide"
statement occurs have any bearing? IOW does that need to be in one of the
events of the form or in the main module?






All times are GMT +1. The time now is 07:28 AM.

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