Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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
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
Closing workbooks w/o closing Excel Barb in MD Excel Discussion (Misc queries) 3 February 15th 10 06:42 PM
closing userforms [email protected] Excel Programming 5 May 11th 05 08:15 PM
Closing VB triggers closing Excel Minilek Excel Programming 2 August 6th 04 05:17 PM
Creating UserForms in Excel RayzGurl Excel Programming 1 February 1st 04 11:55 AM
closing excel after closing a workbook CWalsh[_2_] Excel Programming 3 January 21st 04 03:33 PM


All times are GMT +1. The time now is 08:22 AM.

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"