Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I''ve written the following code to make sure a modeless form hides if the
user activates another workbook while the form is showing. I'm posting to see if there are better ways. I dimension a public variable in a regular code module: Public ShowUserForm1 As Boolean In the ThisWorkbook object module I have: ----------------------------------------------------------------------- Private Sub Workbook_Activate() If ShowUserForm1 Then UserForm1.Show End Sub Private Sub Workbook_Deactivate() If UserForm1.Visible = True Then UserForm1.Hide ShowUserForm1 = True End If End Sub ----------------------------------------------------------------------- In the Terminate code of the Userform I have: ----------------------------------------------------------------------- Private Sub UserForm_Terminate() ShowUserForm1 = False End Sub ----------------------------------------------------------------------- This works great (as far as I've been able to test). Is there a better way? Thanks! -Jeremy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Userform, ComboBox, and Workbooks... Oh my!? | Excel Discussion (Misc queries) | |||
Activating Workbooks | Excel Discussion (Misc queries) | |||
activating workbooks | Excel Discussion (Misc queries) | |||
Modeless userform | New Users to Excel | |||
hide a textbox on a userform? | Excel Programming |