multiple user formshow

  • Thread starter Thread starter gregork
  • Start date Start date
G

gregork

Hi,
This may sound a little strange but is it possible to have 3 user forms
showing on a sheet at the same time?
If yes then how can I do it?

Regards
gregork
 
You can have as many as you like, but the latest one is the only one that
can be active, unless ....

As long as you have XL2000 up, make the calling form modeless
(Userform2.show vbmodeless) and then you can switch between.

Also, take a look at Chip's page as you will probably want to set the form
position so that they start not overlaying each other
http://www.cpearson.com/excel/FormPosition.htm

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Thanks for the reply Bob. I put this code in..........

Private Sub CommandButton3_Click()
UserForm2.Show
UserForm10.Show
UserForm11.Show
End Sub

.........and each userform will only show after I close the first one. I have
set the properties so they are all in different places on the sheet but I
can't get them to show all at the same time? By the way user form 2 is the
form I want to be active the other forms show data related to selections in
form 2. Where am I going wrong?

Many Thanks
gregork
 
Hi

You missed the "vbModeless" after Show

Private Sub CommandButton3_Click()
UserForm2.Show vbModeless
UserForm10.Show vbModeless
UserForm11.Show vbModeless
End Sub

Cheers,
Flemming
 
Thanks Flemming. Do you know how I could get all three forms to close when I
close form 2 ?

Regards
gregork
 
You can use the End command somewhere in your code on Userform2 like this

Userform10.End
Userform11.End

Cheers,
Flemming
 
If you want them modal,

show form1, in its activate event, have it show form3, in the activate
event of form3, have it show form2

Private Sub Userform_Activate() ' form 1 code
userform3.Show
unload me
End Sub

Private Sub Userform_Activate() ' form 3 code
userform2.Show
unload me
End Sub

Private Sub Cmd_OK_Click() ' form 2 code
unload me
End Sub

- add code to position the forms.
 
You need to trap the QueryClose event to trap all close situations, like so
in the Userform2


Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Unload UserForm1
Unload UserForm3
End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top