Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
THANKS!!! Unload is what I needed.
Les "Jim Thomlinson" wrote: Really there are 2 ways to go here depending on what you are wanting to do. The initialize event is only triggered when the userform is first created. Unhiding the userform does not trigger the event. Oddly enough the .show method either creates an instance of the user form or it unhides the existing instance. The Activate event fires when the userform is unhidden. So you might be able to add code to the activate event to solve your problem. This all assumes that you truely want to hide the existing instance of the form. This is true when you want the end user to see the form exactly as they left it when they last used it. If you want the form to be reinitialized each time clearing out what the user last entered then instead of hiding the form you should Unload (delete) it. This completely gets rid of the form so that the next time .show is called a new instance of the form will be created and the initialize event will fire.... -- HTH... Jim Thomlinson "WLMPilot" wrote: I have a userform with optionbutton3 that will make certain labels/textboxes invisible when TRUE. If optionbutton3 is TRUE and then user clicks FINISHED, the userform will HIDE. The problem is when the userform is executed again and those labels/textboxes are still invisible. I appreciate any input on how to fix this! Below are two macros. The first shows the userform. The second is the one that should initialize the userform, making all visible: Sub TimeCalc() Dim TextBox1 As String Dim TextBox2, TextBox3 As String TimeCalcFm.Show End Sub Private Sub UserForm_Initialize() Me.Label1.Caption = "Enter Date Worked" Me.Label2.Visible = True Me.Label3.Visible = True Me.Label4.Visible = True Me.TextBox2.Visible = True Me.TextBox3.Visible = True Me.TextBox1 = "" Me.TextBox2 = "" Me.TextBox3 = "" Me.OptionButton1.Value = True Me.TextBox1.SetFocus End Sub Thanks, Les |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Initializing UserForm | Excel Programming | |||
Userform initializing problem when opening | Excel Programming | |||
stop userform from initializing | Excel Programming | |||
Initializing Combobox in a Userform | Excel Programming | |||
Initializing Userform | Excel Programming |