Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
load/unload userform
I have created a userform with an Initialize event that loads the userform
from a database. To use the form I run Load myForm myForm.Show Unload myForm The form has an OK Button and a Cancel button which both hide the form and then the next line of code unloads (terminates) the form. It all works OK except when the user closes the form by clicking the form's close button (top right cross). When this happens the form actually terminates so when the Unload myForm code runs, because myForm has been terminated it is first re-initialized before it is then terminated. Although there are no errors and it still works OK it is annoying as the initialize event downloads quite e bit of data and so takes quite a while. Is there any way I can find out if myForm has been terminated before I run the Unload command. Thanks, Fred |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
load/unload userform
Not sure if it will help but I use the following test to control the
switching between two overlayed forms...... If the form is not initialized this will return false as well. UserForm1.Visible = True -- Cheers Nigel "Fred" wrote in message ... I have created a userform with an Initialize event that loads the userform from a database. To use the form I run Load myForm myForm.Show Unload myForm The form has an OK Button and a Cancel button which both hide the form and then the next line of code unloads (terminates) the form. It all works OK except when the user closes the form by clicking the form's close button (top right cross). When this happens the form actually terminates so when the Unload myForm code runs, because myForm has been terminated it is first re-initialized before it is then terminated. Although there are no errors and it still works OK it is annoying as the initialize event downloads quite e bit of data and so takes quite a while. Is there any way I can find out if myForm has been terminated before I run the Unload command. Thanks, Fred |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
load/unload userform
Fred,
You can trap that event, and cancel it Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) If CloseMode = 0 Then Cancel = True End If End Sub -- HTH RP (remove nothere from the email address if mailing direct) "Nigel" wrote in message ... Not sure if it will help but I use the following test to control the switching between two overlayed forms...... If the form is not initialized this will return false as well. UserForm1.Visible = True -- Cheers Nigel "Fred" wrote in message ... I have created a userform with an Initialize event that loads the userform from a database. To use the form I run Load myForm myForm.Show Unload myForm The form has an OK Button and a Cancel button which both hide the form and then the next line of code unloads (terminates) the form. It all works OK except when the user closes the form by clicking the form's close button (top right cross). When this happens the form actually terminates so when the Unload myForm code runs, because myForm has been terminated it is first re-initialized before it is then terminated. Although there are no errors and it still works OK it is annoying as the initialize event downloads quite e bit of data and so takes quite a while. Is there any way I can find out if myForm has been terminated before I run the Unload command. Thanks, Fred |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
load/unload userform
Thanks Bob,
that works fine. "Bob Phillips" wrote in message ... Fred, You can trap that event, and cancel it Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) If CloseMode = 0 Then Cancel = True End If End Sub -- HTH RP (remove nothere from the email address if mailing direct) "Nigel" wrote in message ... Not sure if it will help but I use the following test to control the switching between two overlayed forms...... If the form is not initialized this will return false as well. UserForm1.Visible = True -- Cheers Nigel "Fred" wrote in message ... I have created a userform with an Initialize event that loads the userform from a database. To use the form I run Load myForm myForm.Show Unload myForm The form has an OK Button and a Cancel button which both hide the form and then the next line of code unloads (terminates) the form. It all works OK except when the user closes the form by clicking the form's close button (top right cross). When this happens the form actually terminates so when the Unload myForm code runs, because myForm has been terminated it is first re-initialized before it is then terminated. Although there are no errors and it still works OK it is annoying as the initialize event downloads quite e bit of data and so takes quite a while. Is there any way I can find out if myForm has been terminated before I run the Unload command. Thanks, Fred |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Is there a way to unload the loaded XLL file in Excel? Hi all, I amdebugging XLL link library using Visual C++. Everytime I rebuild the XLL, Ihave to close the whole Excel program and relaunch the Excel program again,and then load in the newly gene | Excel Discussion (Misc queries) | |||
Can't load or unload object | Excel Programming | |||
unload userform from within one of that form's beforeupdate events? | Excel Programming | |||
Load and Unload Form commands | Excel Programming | |||
can i have VBA & forms etc load then unload? | Excel Programming |