Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Disable UserForm 'X' Close Button

Instead of just canceling, why not have it run the code in your cancel
button. That's why the user clicked the X anyway, right?

Assuming the cancel button is named btnCancel:

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
btnCancel
End If
End Sub

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


"Mike" wrote in message
...
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
Exit Sub
End If
End Sub

"dimm" wrote:

Hi again,

I hope everyone is keeping well.

I'm wondering if there is any way to disable or remove the X button on
the
top right of a UserForm?



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
How to disable close button in userform? [email protected] Excel Programming 0 February 20th 08 03:53 PM
Disable the Close button on a Userform Moh Excel Programming 7 December 14th 07 05:11 PM
Disable Close Button dan Excel Discussion (Misc queries) 5 September 22nd 06 07:39 PM
How to disable a sheet's x(close) button? Stefi Excel Programming 4 May 6th 05 01:21 PM
Disable close button of Modeless Userform RB Smissaert Excel Programming 2 September 13th 03 09:46 PM


All times are GMT +1. The time now is 05:20 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"