Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Form Actions

Hi,

I have 2 forms on the first form is a button which saves the current work
book, unloads the form and then opens the second form. The problem is when I
click the first button the form does not shut and the second one opens over
the top and when you click the button on the second form to shut it the whole
thing crash's can someone help, here is code I am using

Button One

Private Sub Finnish_Click()
ActiveWorkbook.Save
ActiveWorkbook.SaveAs Filename:="C:\Questionaire.xls"
Unload Me
UserForm3.Show
End Sub

Button Two

Private Sub UserForm_Click()

Unload Me
End Sub


Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Form Actions

Hide the userform before opening the 2nd userform. You don't need the unload.

"Phil" wrote:

Hi,

I have 2 forms on the first form is a button which saves the current work
book, unloads the form and then opens the second form. The problem is when I
click the first button the form does not shut and the second one opens over
the top and when you click the button on the second form to shut it the whole
thing crash's can someone help, here is code I am using

Button One

Private Sub Finnish_Click()
ActiveWorkbook.Save
ActiveWorkbook.SaveAs Filename:="C:\Questionaire.xls"
Unload Me
UserForm3.Show
End Sub

Button Two

Private Sub UserForm_Click()

Unload Me
End Sub


Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Form Actions

Hi Joel,

Thanks for the reply, I have tried what you suggested but am still getting
the same problem, any other thoughts??

Thanks


"Joel" wrote:

Hide the userform before opening the 2nd userform. You don't need the unload.

"Phil" wrote:

Hi,

I have 2 forms on the first form is a button which saves the current work
book, unloads the form and then opens the second form. The problem is when I
click the first button the form does not shut and the second one opens over
the top and when you click the button on the second form to shut it the whole
thing crash's can someone help, here is code I am using

Button One

Private Sub Finnish_Click()
ActiveWorkbook.Save
ActiveWorkbook.SaveAs Filename:="C:\Questionaire.xls"
Unload Me
UserForm3.Show
End Sub

Button Two

Private Sub UserForm_Click()

Unload Me
End Sub


Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Form Actions

I thought this would work

Private Sub Finnish_Click()
ActiveWorkbook.Save
ActiveWorkbook.SaveAs Filename:="C:\Questionaire.xls"
Userform2.Hide
UserForm3.Show
End Sub

Button Two

Private Sub UserForm_Click()

msgbox("Put some code here to stop userform three from immediately shutting
down")
Userform3.Unload
End Sub


"Phil" wrote:

Hi Joel,

Thanks for the reply, I have tried what you suggested but am still getting
the same problem, any other thoughts??

Thanks


"Joel" wrote:

Hide the userform before opening the 2nd userform. You don't need the unload.

"Phil" wrote:

Hi,

I have 2 forms on the first form is a button which saves the current work
book, unloads the form and then opens the second form. The problem is when I
click the first button the form does not shut and the second one opens over
the top and when you click the button on the second form to shut it the whole
thing crash's can someone help, here is code I am using

Button One

Private Sub Finnish_Click()
ActiveWorkbook.Save
ActiveWorkbook.SaveAs Filename:="C:\Questionaire.xls"
Unload Me
UserForm3.Show
End Sub

Button Two

Private Sub UserForm_Click()

Unload Me
End Sub


Thanks

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 533
Default Form Actions

Create a new sub in a standard module that shows the second form:

Sub OpenSecondForm()
UserForm3.Show
End Sub

Back in Sub Finnish_Click replace:

UserForm3.Show

with

Application.OnTime Now, "OpenSecondForm"

--
Jim
"Phil" wrote in message
...
| Hi Joel,
|
| Thanks for the reply, I have tried what you suggested but am still getting
| the same problem, any other thoughts??
|
| Thanks
|
|
| "Joel" wrote:
|
| Hide the userform before opening the 2nd userform. You don't need the
unload.
|
| "Phil" wrote:
|
| Hi,
|
| I have 2 forms on the first form is a button which saves the current
work
| book, unloads the form and then opens the second form. The problem is
when I
| click the first button the form does not shut and the second one opens
over
| the top and when you click the button on the second form to shut it
the whole
| thing crash's can someone help, here is code I am using
|
| Button One
|
| Private Sub Finnish_Click()
| ActiveWorkbook.Save
| ActiveWorkbook.SaveAs Filename:="C:\Questionaire.xls"
| Unload Me
| UserForm3.Show
| End Sub
|
| Button Two
|
| Private Sub UserForm_Click()
|
| Unload Me
| End Sub
|
|
| Thanks




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Form Actions

Hi Jim,

Thanks for the reply, that worked brilliantly,

Dont suppose you can tell me why they way that I was doing it wasn't
working, just like to know for next time.

Thanks Phil

"Jim Rech" wrote:

Create a new sub in a standard module that shows the second form:

Sub OpenSecondForm()
UserForm3.Show
End Sub

Back in Sub Finnish_Click replace:

UserForm3.Show

with

Application.OnTime Now, "OpenSecondForm"

--
Jim
"Phil" wrote in message
...
| Hi Joel,
|
| Thanks for the reply, I have tried what you suggested but am still getting
| the same problem, any other thoughts??
|
| Thanks
|
|
| "Joel" wrote:
|
| Hide the userform before opening the 2nd userform. You don't need the
unload.
|
| "Phil" wrote:
|
| Hi,
|
| I have 2 forms on the first form is a button which saves the current
work
| book, unloads the form and then opens the second form. The problem is
when I
| click the first button the form does not shut and the second one opens
over
| the top and when you click the button on the second form to shut it
the whole
| thing crash's can someone help, here is code I am using
|
| Button One
|
| Private Sub Finnish_Click()
| ActiveWorkbook.Save
| ActiveWorkbook.SaveAs Filename:="C:\Questionaire.xls"
| Unload Me
| UserForm3.Show
| End Sub
|
| Button Two
|
| Private Sub UserForm_Click()
|
| Unload Me
| End Sub
|
|
| Thanks



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 533
Default Form Actions

Well, the problem is that when you unload a userform in a sub it doesn't
really unload until that sub is done running. And since that sub opened
another userform that sub is not done until the second form is closed. It
can get messy. Using OnTime breaks the connection because it allows the sub
with the unload to complete before the code that opens the second form is
run.

--
Jim
"Phil" wrote in message
...
| Hi Jim,
|
| Thanks for the reply, that worked brilliantly,
|
| Dont suppose you can tell me why they way that I was doing it wasn't
| working, just like to know for next time.
|
| Thanks Phil
|
| "Jim Rech" wrote:
|
| Create a new sub in a standard module that shows the second form:
|
| Sub OpenSecondForm()
| UserForm3.Show
| End Sub
|
| Back in Sub Finnish_Click replace:
|
| UserForm3.Show
|
| with
|
| Application.OnTime Now, "OpenSecondForm"
|
| --
| Jim
| "Phil" wrote in message
| ...
| | Hi Joel,
| |
| | Thanks for the reply, I have tried what you suggested but am still
getting
| | the same problem, any other thoughts??
| |
| | Thanks
| |
| |
| | "Joel" wrote:
| |
| | Hide the userform before opening the 2nd userform. You don't need
the
| unload.
| |
| | "Phil" wrote:
| |
| | Hi,
| |
| | I have 2 forms on the first form is a button which saves the
current
| work
| | book, unloads the form and then opens the second form. The
problem is
| when I
| | click the first button the form does not shut and the second one
opens
| over
| | the top and when you click the button on the second form to shut
it
| the whole
| | thing crash's can someone help, here is code I am using
| |
| | Button One
| |
| | Private Sub Finnish_Click()
| | ActiveWorkbook.Save
| | ActiveWorkbook.SaveAs Filename:="C:\Questionaire.xls"
| | Unload Me
| | UserForm3.Show
| | End Sub
| |
| | Button Two
| |
| | Private Sub UserForm_Click()
| |
| | Unload Me
| | End Sub
| |
| |
| | Thanks
|
|
|


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
if - then actions N+ Excel Programming 5 February 10th 08 03:38 PM
Capture All Actions 2 vqthomf Excel Programming 1 October 4th 06 01:21 PM
Actions between user actions Indiana Epilepsy and Child Neurology[_2_] Excel Programming 5 August 23rd 06 09:22 PM
How to perform two actions ? morph000 Excel Worksheet Functions 5 January 22nd 06 02:13 AM
Actions on certain Worksheets Grant Reid Excel Programming 5 May 10th 04 02:45 PM


All times are GMT +1. The time now is 05:25 AM.

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

About Us

"It's about Microsoft Excel"