Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userform from a Userform Problem
I have an excel workbook which when opened runs a userform. On this userform
are various commandbuttons which do various things. One button (commandButton1), hides the current form then opens a userform called setup, when that userform is closed using 'unload me' in the setup userform code control passes back to the Command Button 1 click procedure, the next line of which is to re-show the first userform. This works fine - no problems. The code which achieves this little bit is he Private Sub CommandButton1_Click() Me.Hide Setup.Show Me.Show End Sub The second button does a similar thing but with a different userform. The closure for this is the same as before (ie an unload me in the code of the second form). Again this form worked just fine UNTIL ... I added a control on the second userform (confusingly called userform1). After adding this one control the userform closes just fine, but the original form doesnt stay opened. Using debug, I have followed the code through and it executes corrrectly, including showing the userform again (me.show). But when it executes the EndSub the form closes. The code is (except for userform names) identical. Private Sub CommandButton2_Click() Me.Hide UserForm1.Show Me.Show End Sub Why doesnt it work? What can I do about it? Ive gone back to my original and done it all again in case I had stuffed something up, but no success. Its Excel 2003 sp1 running on a Windows 2000 SP 4 server. Thanks Adrian |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userform from a Userform Problem
Adrian,
I couldn't replicate this behaviour, Excel 2002. What control did you add, and is there anything else that might be relevant. -- HTH Bob Phillips "Adrian" wrote in message ... I have an excel workbook which when opened runs a userform. On this userform are various commandbuttons which do various things. One button (commandButton1), hides the current form then opens a userform called setup, when that userform is closed using 'unload me' in the setup userform code control passes back to the Command Button 1 click procedure, the next line of which is to re-show the first userform. This works fine - no problems. The code which achieves this little bit is he Private Sub CommandButton1_Click() Me.Hide Setup.Show Me.Show End Sub The second button does a similar thing but with a different userform. The closure for this is the same as before (ie an unload me in the code of the second form). Again this form worked just fine UNTIL ... I added a control on the second userform (confusingly called userform1). After adding this one control the userform closes just fine, but the original form doesnt stay opened. Using debug, I have followed the code through and it executes corrrectly, including showing the userform again (me.show). But when it executes the EndSub the form closes. The code is (except for userform names) identical. Private Sub CommandButton2_Click() Me.Hide UserForm1.Show Me.Show End Sub Why doesnt it work? What can I do about it? Ive gone back to my original and done it all again in case I had stuffed something up, but no success. Its Excel 2003 sp1 running on a Windows 2000 SP 4 server. Thanks Adrian |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Looping procedure calls userform; how to exit loop (via userform button)? | Excel Programming | |||
Activating userform and filling it with data form row where userform is activate | Excel Programming | |||
Access from add_in userform to main template userform.... | Excel Programming | |||
Linking userform to userform in Excel 2003 | Excel Programming | |||
Userform Problem | Excel Programming |