Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Close X button on Usser Form

Hi Gentleman.

I have a form that has the blue title bar along with the "X" in the upper
right corner.

I am having trouble finding the code or process of eliminating the "X" so
the user will have only once choice to close the form through the Close
button created in the form.

Any suggestions would be highly appriciated to get be through this hurdle.

Thanks!
--
SBR
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Close X button on Usser Form

Here's a better way. The user wants to close the form, so let them close the
form using either the close button or the big X in the corner. When they
click the X, you simply want to cancel the normal behavior of the X and run
the close button code.

Put this procedure into your userform code module:

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
' how was the form closed? vbFormControlMenu = X in corner of title bar
If CloseMode = vbFormControlMenu Then
' cancel normal X button behavior
Cancel = True
' run code for click of Close/Cancel button
btnCancel_Click
End If
End Sub

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______



"Scardona Bay Viktor" wrote in
message ...
Hi Gentleman.

I have a form that has the blue title bar along with the "X" in the upper
right corner.

I am having trouble finding the code or process of eliminating the "X" so
the user will have only once choice to close the form through the Close
button created in the form.

Any suggestions would be highly appriciated to get be through this hurdle.

Thanks!
--
SBR



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
Close user form when button is pressed april27 Excel Programming 1 June 16th 06 11:03 AM
Form Close Button ceemo[_37_] Excel Programming 3 October 12th 05 10:39 PM
Excel shoud not close all active books when clicking close button technomike Excel Discussion (Misc queries) 0 June 10th 05 05:35 PM
Form Close button fran Excel Programming 2 September 16th 03 09:32 PM
SIMPLEST way to disable "close" button on form? codytheretriever Excel Programming 4 August 7th 03 09:00 PM


All times are GMT +1. The time now is 10:00 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"