Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Closing excel userforms
I have a multiworksheet workbook with userforms that are needed sometimes
but not all of the time on different sheets. I have a navigator form that is always shown and that has checkboxes, each will open/close the appropriate larger userform when needed. When the larger userform closes/hides from either clicking the navigator check box or when the larger userform closes from a command button, everything is fine because I have it clear the checkbox on the navigator form. The problem arises when a person closes the larger userforms with the x button on the userform title bar - then the navigator checkbox isn't cleared and they get out of synch. I can't find a VBA name that is like On_Unload or something that will clear the box whenever the userform is hidden or unloaded. I tried queryclose, but no avail - probably did it wrong. Thanks for any help that you can offer. Jim |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Closing excel userforms
Jim,
Try this in the form code Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) If CloseMode = vbFormControlMenu Then Cancel = True End Sub Henry "Jim" wrote in message 6... I have a multiworksheet workbook with userforms that are needed sometimes but not all of the time on different sheets. I have a navigator form that is always shown and that has checkboxes, each will open/close the appropriate larger userform when needed. When the larger userform closes/hides from either clicking the navigator check box or when the larger userform closes from a command button, everything is fine because I have it clear the checkbox on the navigator form. The problem arises when a person closes the larger userforms with the x button on the userform title bar - then the navigator checkbox isn't cleared and they get out of synch. I can't find a VBA name that is like On_Unload or something that will clear the box whenever the userform is hidden or unloaded. I tried queryclose, but no avail - probably did it wrong. Thanks for any help that you can offer. Jim |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Closing excel userforms
Henry,
Thanks - that worked. I see it stopped the larger userform from closing with the x in the first place. Funny thing, when I used the name of the form (Settings_Form) instead of userform, it didn't work. Is this because of the underscore between Settings and Form. ? Again, my thanks. Jim "Henry" wrote in : Jim, Try this in the form code Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) If CloseMode = vbFormControlMenu Then Cancel = True End Sub Henry "Jim" wrote in message 6... I have a multiworksheet workbook with userforms that are needed sometimes but not all of the time on different sheets. I have a navigator form that is always shown and that has checkboxes, each will open/close the appropriate larger userform when needed. When the larger userform closes/hides from either clicking the navigator check box or when the larger userform closes from a command button, everything is fine because I have it clear the checkbox on the navigator form. The problem arises when a person closes the larger userforms with the x button on the userform title bar - then the navigator checkbox isn't cleared and they get out of synch. I can't find a VBA name that is like On_Unload or something that will clear the box whenever the userform is hidden or unloaded. I tried queryclose, but no avail - probably did it wrong. Thanks for any help that you can offer. Jim |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Closing excel userforms
Jim,
No it is because it is not referring to the name of the form (Settings_Form), but the Userform object itself. -- HTH RP (remove nothere from the email address if mailing direct) "Jim" wrote in message 6... Henry, Thanks - that worked. I see it stopped the larger userform from closing with the x in the first place. Funny thing, when I used the name of the form (Settings_Form) instead of userform, it didn't work. Is this because of the underscore between Settings and Form. ? Again, my thanks. Jim "Henry" wrote in : Jim, Try this in the form code Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) If CloseMode = vbFormControlMenu Then Cancel = True End Sub Henry "Jim" wrote in message 6... I have a multiworksheet workbook with userforms that are needed sometimes but not all of the time on different sheets. I have a navigator form that is always shown and that has checkboxes, each will open/close the appropriate larger userform when needed. When the larger userform closes/hides from either clicking the navigator check box or when the larger userform closes from a command button, everything is fine because I have it clear the checkbox on the navigator form. The problem arises when a person closes the larger userforms with the x button on the userform title bar - then the navigator checkbox isn't cleared and they get out of synch. I can't find a VBA name that is like On_Unload or something that will clear the box whenever the userform is hidden or unloaded. I tried queryclose, but no avail - probably did it wrong. Thanks for any help that you can offer. Jim |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Closing excel userforms
Bob (and Henry before him)
The light shines upon us mortals. Again, my thanks Jim "Bob Phillips" wrote in news:#OWTC : Jim, No it is because it is not referring to the name of the form (Settings_Form), but the Userform object itself. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Closing workbooks w/o closing Excel | Excel Discussion (Misc queries) | |||
closing userforms | Excel Programming | |||
Closing VB triggers closing Excel | Excel Programming | |||
Creating UserForms in Excel | Excel Programming | |||
closing excel after closing a workbook | Excel Programming |