Hi,
I have been trying to get several userforms to load, unload, hide etc and generally behave properly. This is isn't the actual code however this is the sort of problem I am having. I am trying to load and unload forms from other forms, however when I go back to a form that has been unloaded it doesn't work, by that i mean it shows the form but nothing on it works. A really basic example of my problem, two userforms both with buttons on, button1 on userform1 calls userform2 (unload, load, show). Button2 on userform2 does the same but userform2 also uses queryclose to set a boolean variable and then runs code on terminate if that boolean is true. The code it runs is exactly the same as if the button has been pressed however when userform2 is reloaded from userform1 it doesn't work. This is the code from userform2:-
Userform1 justs has code for the cmdbutton to open userform2.
Any advice would be much appreciated
Thanks
Andy
I have been trying to get several userforms to load, unload, hide etc and generally behave properly. This is isn't the actual code however this is the sort of problem I am having. I am trying to load and unload forms from other forms, however when I go back to a form that has been unloaded it doesn't work, by that i mean it shows the form but nothing on it works. A really basic example of my problem, two userforms both with buttons on, button1 on userform1 calls userform2 (unload, load, show). Button2 on userform2 does the same but userform2 also uses queryclose to set a boolean variable and then runs code on terminate if that boolean is true. The code it runs is exactly the same as if the button has been pressed however when userform2 is reloaded from userform1 it doesn't work. This is the code from userform2:-
Code:
Private trueOrNot As Boolean
Private Sub CommandButton1_Click()
Unload Me
Load UserForm1
UserForm1.Show
End Sub
Private Sub UserForm_QueryClose(cancel As Integer, closemode As Integer)
If closemode = vbFormControlMenu Then trueOrNot = True
End Sub
Private Sub UserForm_Terminate()
If trueOrNot = True Then
Unload Me
Load UserForm1
UserForm1.Show
End If
End Sub
Userform1 justs has code for the cmdbutton to open userform2.
Any advice would be much appreciated
Thanks
Andy