Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Looping procedure calls userform; how to exit loop (via userform button)? KR Excel Programming 6 July 27th 05 12:57 PM
Activating userform and filling it with data form row where userform is activate Marthijn Beusekom via OfficeKB.com[_2_] Excel Programming 3 May 6th 05 05:44 PM
Access from add_in userform to main template userform.... Ajit Excel Programming 1 November 18th 04 05:15 PM
Linking userform to userform in Excel 2003 missmelis01 Excel Programming 2 August 27th 04 08:07 PM
Userform Problem Todd Huttenstine Excel Programming 2 February 15th 04 09:54 PM


All times are GMT +1. The time now is 11:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"