I call a userform2 via commanbutton1 from other userform.
i use userform2.show
I use from userform2 a "x" in the top to close it or a commandbutton unload me.
But is possible to make in standby the userform2 without call the event UserForm_Initialize when i reclick on commanbutton1 of pricipal userform...
Sorry me for bad languge, i hope understand me:-)
make userform in stnd by
-
- Administrator
- Posts: 78631
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: make userform in stnd by
Yes. In the first place, make the command button hide the form instead of unload:
Because the form is hidden but not unloaded, next time you show the form, it is not initialized.
In the second place, you may want to prevent the users from closing the form through the "x" in the upper right corner:
This disables closing through the "x" button, but not through a command button (or from Task Manager)
Code: Select all
Private Sub CommandButton1_Click()
Me.Hide
End Sub
In the second place, you may want to prevent the users from closing the form through the "x" in the upper right corner:
Code: Select all
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Cancel = (CloseMode = vbFormControlMenu)
End Sub
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4373
- Joined: 26 Apr 2010, 17:36
Re: make userform in stnd by
HansV wrote:Yes. In the first place, make the command button hide the form instead of unload:
Because the form is hidden but not unloaded, next time you show the form, it is not initialized.Code: Select all
Private Sub CommandButton1_Click() Me.Hide End Sub
In the second place, you may want to prevent the users from closing the form through the "x" in the upper right corner:
This disables closing through the "x" button, but not through a command button (or from Task Manager)Code: Select all
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) Cancel = (CloseMode = vbFormControlMenu) End Sub