PC Review


Reply
Thread Tools Rate Thread

Disable UserForm 'X' Close Button

 
 
dimm
Guest
Posts: n/a
 
      25th Mar 2008
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 With Quote
 
 
 
 
Mike
Guest
Posts: n/a
 
      25th Mar 2008
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 With Quote
 
Jon Peltier
Guest
Posts: n/a
 
      25th Mar 2008
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" <(E-Mail Removed)> wrote in message
news:2C190C30-A70D-41D4-A98D-(E-Mail Removed)...
> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to disable close button in userform? yajiv.vijay@gmail.com Microsoft Excel Programming 2 20th Feb 2008 03:53 PM
Disable the Close button on a Userform Moh Microsoft Excel Programming 7 14th Dec 2007 05:11 PM
Disable Close button and remove Close menu and then reactivate fpsoft Microsoft Dot NET Framework Forms 0 23rd Sep 2007 03:55 PM
excel vba - how to disable userform close button "x"? chief Microsoft Excel Misc 2 7th May 2004 02:05 PM
Disable close button of Modeless Userform RB Smissaert Microsoft Excel Programming 2 13th Sep 2003 09:46 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:17 PM.