Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 | | | |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for that Jim, its much appreciated I am sure its not going to be the
last time that I have to do something like this. Thanks PD "Jim Rech" wrote: 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
if - then actions | Excel Programming | |||
Capture All Actions 2 | Excel Programming | |||
Actions between user actions | Excel Programming | |||
How to perform two actions ? | Excel Worksheet Functions | |||
Actions on certain Worksheets | Excel Programming |